public function afterConstruct($event) { parent::afterConstruct($event); if (!$this->model) { throw new Exception('Нужно установить модель для HistoricalBehavior'); } }
public function afterConstruct($e) { if (empty($this->columns) || !is_array($this->columns) || count($this->columns) < 1) { throw new CException('No columns in settings of behaviour'); } if (empty($this->fields) || !is_array($this->fields) || count($this->fields) < 1) { throw new CException('No fields in settings of behaviour'); } return parent::afterConstruct($e); }
/** * 初始化 * @param CEvent $event * @throws CException */ public function afterConstruct($event) { parent::afterConstruct($event); //检查是否设置了权限纬度 $properties = (new ReflectionClass($this->owner))->getProperties(); $propsArray = array(); foreach ($properties as $prop) { $propsArray[] = $prop->getName(); } foreach ($this->config as $k => $item) { if (trim($item['prefix'] == '')) { break; } if (!is_array($item['scope']) || sizeof($item['scope']) == 0) { $this->config[$k]['scope'] = $this->privScopes; } else { foreach ($item['scope'] as $scope) { if (!in_array($item['prefix'] . $scope, $propsArray)) { throw new CException(Yii::t('core', '权限类型名称配置错误!')); } } } } }
/** * On after construct event of an active record * * @param type $event */ public function afterConstruct($event) { // Intercept this controller Yii::app()->interceptor->intercept($this); parent::afterConstruct($event); }