我正在尝试实现 Audit Trail 插件 - https://github.com/robwilkerson/CakePHP-Audit-Log-Plugin
一切都很好,但是我无法按照说明进行用户身份验证,但出现以下错误-
Fatal error: Call to undefined method CakeErrorController::currentUser()
我已按照说明添加
protected function currentUser() {
$user = $this->Auth->user();
return $user[$this->Auth->userModel]; # Return the complete user array
}
并添加
public function beforeFilter() {
...
if( !empty( $this->data ) && empty( $this->data[$this->Auth->userModel] ) ) {
$this->data[$this->Auth->userModel] = $this->currentUser();
}
}
到我的 appController 之前,有没有人实现过这个或认识到错误?