Timestamp behavior not working


I´ve been trying to make the TimestampBehavior work for a couple of days but was unable. I followed a dozen of examples and read the official doc as well.

This is one of the ways I tried:

public function behaviors()


        return [

              	'timestamp' => [

        		'class' => TimestampBehavior::className(),

        		'createdAtAttribute' => 'fecha_creacion',

        		'updatedAtAttribute' => 'fecha_actualizacion',

        		'value' => new Expression('NOW()'),





Both date fields are set as DATETIME in the mysql DB. At creation, the ´fecha_creacion’ gets 0000-00-00 00:00:00 cause as it’s set as NOT NULL in db, whereas at update, the ‘fecha_actualizacion’ doesn’t even get a value.

Thanks in advance


Silly error, put the code in the controller by mistake. Hope this helps some else