/** * Returns the static model of the specified AR class. * Please note that you should have this exact method in all your CActiveRecord descendants! * @param string $className active record class name. * @return Yeshuv the static model class */ public static function model($className = __CLASS__) { return parent::model($className); }
/** * Deletes all ads before deleting the screen. */ public function beforeDelete() { foreach ($this->ads as $ad) { $ad->delete(); } return parent::beforeDelete(); }
/** * 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; }
protected function afterValidate() { //convert to storage format if ($this->hasErrors()) { $this->end_date = Yii::app()->dateFormatter->format('dd/MM/yyyy HH:mm', $this->end_date_timestamp); $this->start_date = Yii::app()->dateFormatter->format('dd/MM/yyyy HH:mm', $this->start_date_timestamp); } return parent::afterValidate(); }