Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
How to get ORM Observer to use MySQL datetime
Hey everyone, I was trying to get the ORM Observers to use MySQL datetimes rather than unix timestamps, however I can't figure out how to use the code provided in the docs. They provide this code:
Orm\Observer_CreatedAt::$mysql_timestamp = true; But where do I use this? In the model? It doesn't seem to work there. Thanks!
As per Jelmer on StackOverflow:
This is something that was put in a bit hacky and should have been a config value from the beginning, something we'll fix for 1.1. Best way to do it right now is probably to give the models using the CreatedAt/UpdatedAt observers an _init() method like the code below. The init method is called by the autoloader after loading the class. public static function _init()
Orm\Observer_CreatedAt::$mysql_timestamp = true;
Orm\Observer_UpdatedAt::$mysql_timestamp = true;
Add a Comment
It looks like you're new here. If you want to get involved, click one of these buttons!
Apply for Membership
↳ Job Board
↳ Installation & Setup
↳ Tips and Tutorials
↳ Code share
In this Discussion