In my model it uses the TimestampBehavior class
[
'class' => TimestampBehavior::className(),
'updatedAtAttribute' => 'featured_on',
]
When the query ran, it ran this
UPDATE `theme` SET `featured_on`='1532025711', `rating`='3', `css`='sh: 1: sassc: not found', `review_count`=1 WHERE `id`=227
In MySQL 5.7 with strict settings enabled this generates an error
Invalid datetime format: 1292 Incorrect datetime value: '1532025711' for column 'featured_on'
The field definition is
+---------------+--------------------------------------------+------+-----+-------------------+-----------------------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+--------------------------------------------+------+-----+-------------------+-----------------------------+
| featured_on | timestamp | YES | | NULL | |
+---------------+--------------------------------------------+------+-----+-------------------+-----------------------------+
The weirder thing is the default value for the property value of the TimestampBehavior is new Expression(‘NOW()’)
When I explicitly set the value property it works
[
'class' => TimestampBehavior::className(),
'updatedAtAttribute' => 'featured_on',
'value' => new Expression('NOW()'), // using CURRENT_TIMESTAMP also works
]