Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Updated_at timestamp !?
  • Hi there,

    I have a model like this :
    class Model_Campaign extends \Orm\Model
    {
        protected static $_properties = array(
            'id',
            'name',
            'created_at',
            'updated_at'
        );
        protected static $_observers = array(
            'Orm\Observer_CreatedAt' => array(
                'events' => array('before_insert'),
                'mysql_timestamp' => false,
            ),

            'Orm\Observer_UpdatedAt' => array(
                'events' => array('before_save'),
                'mysql_timestamp' => false,
            ),
        );

    If
    I set the 'mysql_timestamp' => TO TRUE, in the database I will
    receive in the updated_at column "2012". Only if I let the value settled
    to false, it inserts the correct timestamp value! 

    Why ? Because in the documentation I found :


    [code]
    protected
    static $_observers = array(
    'Orm\\Observer_UpdatedAt' => array(
    'events' => array('before_save'),
    'mysql_timestamp' => true,
    'property' => 'updated',
    ),
    );

    So it should be settled to true or false ... ?

    Thanks
  • HarroHarro
    Accepted Answer
    If 'true' the field should be defined as a MySQL datetime column, if 'false' it should be defined as INT(11). So the value this field should have depends on the type of column you have defined.
  • Ok, I understand now. It's defined int(11), so must be false.
    Thanks

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion