Yii2 TimestampBehavior mark attribute as 'Object' when trying to read.

create a simple database table to test time-stamp behaviour




use yii\db\Expression;


public function behaviors()

{

    return [

        [

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

            'createdAtAttribute' => 'create_time',

            'updatedAtAttribute' => 'update_time',

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

        ],

    ];

}



save and immediately read create_time as follows:





$model->save();

var_dump($model->create_time);




It gets an object instead of timestamp




  yii\db\Expression Object

  (

      [expression] => NOW()

      [params] => Array

          (

          )

  

  )



should call $model->refresh() to get real data instread of objects.