1
Declaration of UtilityBehavior::beforeDelete() should be compatible with ModelBehavior::beforeDelete(Model $model, $cascade = true)

当我加载一个控制器时出现此错误,但它不存在于任何其他控制器中。

这是 Term 控制器中唯一的删除操作

public function admin_delete($id = null) {
        if (!$this->request->is('post')) {
            throw new MethodNotAllowedException();
        }
        $this->Term->id = $id;
        if (!$this->Term->exists()) {
            throw new NotFoundException(__('Invalid term'));
        }
        if ($this->Term->delete()) {
            $this->Session->setFlash(__('Term deleted'));
            $this->redirect(array('action' => 'index'));
        }
        $this->Session->setFlash(__('term was not deleted'));
        $this->redirect(array('action' => 'index'));
    }

控制器是术语控制器

4

1 回答 1

3

修复行为方法的声明。如果可能,也将正确的版本提交给插件的维护者(如果不是你的话)。

正如错误消息已经提到的,它应该是

public function beforeDelete(Model $model, $cascade = true) {}

你的可能只是

public function beforeDelete(Model $model) {}

等等

于 2013-07-19T11:57:08.693 回答