Last active
April 1, 2016 08:11
-
-
Save alexaandrov/57a6f10145bb01172bc7 to your computer and use it in GitHub Desktop.
Поведение для автоматического обновления даты при редактировании и создании записи в таблице
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function behaviors() | |
{ | |
return [ | |
'timestamp' => [ | |
'class' => 'yii\behaviors\TimestampBehavior', | |
'attributes' => [ | |
\yii\db\ActiveRecord::EVENT_BEFORE_INSERT => ['date_create', 'date_update'], | |
\yii\db\ActiveRecord::EVENT_BEFORE_UPDATE => ['date_update'], | |
], | |
], | |
]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment