Esempio n. 1
0
 /**
  * Overloading the beforeSave function to make sure encryption
  * is done for the password before create and update.
  */
 protected function beforeSave()
 {
     if (parent::beforeSave()) {
         $this->pwd_hash = $this->myHash($this->password);
         return TRUE;
     }
     return FALSE;
 }
Esempio n. 2
0
 protected function beforeSave()
 {
     //convert to storage format
     $this->expire = CDateTimeParser::parse($this->expire, 'dd/MM/yyyy');
     $this->expire = Yii::app()->dateFormatter->format('yyyy-MM-dd', $this->expire);
     $this->start = CDateTimeParser::parse($this->start, 'dd/MM/yyyy');
     $this->start = Yii::app()->dateFormatter->format('yyyy-MM-dd', $this->start);
     if ($this->duration != null) {
         $this->duration = $this->duration * 1000;
     }
     return parent::beforeSave();
 }