I tought that this would automatically update the field 'updated_at' in my tables, executing the function 'before_save', but it does not. I started my project in fuelphp 1.4 and upgraded at each release, could there be a problem there ? I undestood that now the fields are added in the properties which i corrected, but it does not improve the behaviour I have.
What did I miss or misunderstood to have this working ?
That is indeed the idea behind it, and it works fine here.
Defined like this, your model must define columns called 'created_at' and 'updated_at', which must be created as "unsigned int" to store a unix timestamp.
Note that UpdatedAt is only triggered on update, not on insert, so the first save should only update the created_at column, subsequent saves only the updated_at column. Also Note that if you save an ORM object without changing anything, it will not run an UPDATE query, and the column will not be updated.
So that's what I have. I have just made some tests to verify, and created_at and updated_at are not updated except when I create a user with simple_auth then the created_at is set. In all other cases there is no update in all the tables I have. Just to make sure I also replaced this 'created_at' => array('constraint' => 11, 'type' => 'int'), 'updated_at' => array('constraint' => 11, 'type' => 'int'), by this 'created_at' => array('constraint' => 11, 'type' => 'int', 'unsigned' => true), 'updated_at' => array('constraint' => 11, 'type' => 'int', 'unsigned' => true), I even broke my database and recreated it with the migration process, but that does not change anything. I don't kow where else to search... Any idea ?