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:



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.