/** * * @throws Exception */ public function init() { if ($this->modelClass === null) { throw new Exception(__CLASS__ . '::$modelClass must be set.'); } $this->model = new $this->modelClass(); if ($this->model === null) { throw new Exception($this->modelClass . 'must be exists.'); } if (!$this->model->is_attribute($this->attribute)) { throw new Exception($this->modelClass . '::' . $this->attribute . ' attribute doesn\'t exist'); } if (!$this->model->is_scenario($this->attribute)) { throw new Exception($this->modelClass . '::' . $this->attribute . ' scenario doesn\'t exist'); } }
/** * @inheritdoc */ public function afterSave($insert, $changedAttributes) { $this->refreshCountObject(); return parent::afterSave($insert, $changedAttributes); }