/** * Extends setAttributes to handle active date fields * * @param $values array * @param $safeOnly boolean */ public function setAttributes($values, $safeOnly = true) { foreach ($this->widgetAttributes() as $fieldName => $className) { if (isset($values[$fieldName]) && class_exists($className)) { $class = new $className(); $arr = $this->widgetParams($fieldName); if ($arr) { $newParams = $class->params; $arr = (array) CJavaScript::jsonDecode($arr); foreach ($arr as $p => $v) { if (isset($newParams[$p])) { $newParams[$p] = $v; } } $class->params = $newParams; } if (method_exists($class, 'setAttributes')) { $values[$fieldName] = $class->setAttributes($values[$fieldName], $this, $fieldName); } } } parent::setAttributes($values, $safeOnly); }
/** * Returns the static model of the specified AR class. * @return CActiveRecord the static model class */ public static function model($className = __CLASS__) { return parent::model($className); }
/** * */ public function afterDelete() { $this->_deletePicture(); parent::afterDelete(); }
protected function beforeSave() { if ($this->scenario == 'insert') { $this->user_id = Yii::app()->user->id; } return parent::beforeSave(); }