Created
June 17, 2013 07:40
-
-
Save amirkheirabadi73/5795238 to your computer and use it in GitHub Desktop.
Set Filed Befor Save Record
This file contains 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
mode () : | |
protected function beforeSave() | |
{ | |
if(parent::beforeSave()) | |
{ | |
if($this->isNewRecord) | |
{ | |
$this->create_time=$this->update_time=time(); | |
$this->author_id=Yii::app()->user->id; | |
} | |
else | |
$this->update_time=time(); | |
return true; | |
} | |
else | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment