Skip to content

Instantly share code, notes, and snippets.

@amirkheirabadi73
Created June 17, 2013 07:40
Show Gist options
  • Save amirkheirabadi73/5795238 to your computer and use it in GitHub Desktop.
Save amirkheirabadi73/5795238 to your computer and use it in GitHub Desktop.
Set Filed Befor Save Record
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