Exemplo n.º 1
0
 /**
  * @return bool
  */
 protected function beforeSave()
 {
     // hash password on create
     if (($this->scenario == 'create' || $this->scenario == 'edit') && !empty($this->UserPassword)) {
         $this->UserPassword = md5($this->UserPassword);
     }
     // don't clear password if not set
     if (empty($this->UserPassword)) {
         unset($this->UserPassword);
     }
     return parent::beforeSave();
 }