/** * @inheritdoc */ public function beforeDelete() { if ($this->depth == 0) { throw new \BadMethodCallException(\Yii::t('modules/post', "Root category can not be deleted.")); } return parent::beforeDelete(); }
/** * @inheritdoc */ public function beforeDelete() { if (!$this->pid) { throw new Exception("Can not delete the root page"); } return parent::beforeDelete(); }