Answer the question
In order to leave comments, you need to log in
In yii2, how is it customary to update created_at and updated_at fields that are stored in integer?
In yii2, how is it customary to update created_at and updated_at fields in database tables that are stored in integer?
Answer the question
In order to leave comments, you need to log in
Found. Who needs:
/**
* @inheritdoc
*/
public function behaviors()
{
return [
'timestamp' => [
'class' => TimestampBehavior::className(),
'attributes' => [
ActiveRecord::EVENT_BEFORE_INSERT => ['created_at', 'updated_at'],
ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at'],
],
],
];
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question