缺少单元类

时间:2017-08-30 15:01:32

标签: php cakephp cakephp-3.0

错误:

Cell class Audit.AuditCell is missing. Cake\View\Exception\MissingCellException

插件文件:

plugins/Audit/src/Template/Cell/Audit/model.ctp
plugins/Audit/src/View/Cell/AuditCell.php

在,src/Template/Servers/view.ctp

echo $this->cell('Audit.Audit::model', [strtolower($this->request->controller), $this->request->pass[0]]);

在,config/bootstrap.php

Plugin::load('Audit', ['bootstrap' => true, 'routes' => true]);

使用CakePHP 3.3.16

编辑#1

我的IDE快照:

enter image description here

编辑#2

我的composer.json的相关部分

"require": {
    "php": ">=5.5.9",
    "cakephp/cakephp": "3.3.*",
    "mobiledetect/mobiledetectlib": "2.*",
    "cakephp/migrations": "~1.0",
    "cakephp/plugin-installer": "*",
    "adayth/cakephp-cipher-behavior": "^1.0"
},
"autoload": {
    "psr-4": {
        "App\\": "src",
        "Audit\\": "./plugins/Audit/src"
    }
},
"autoload-dev": {
    "psr-4": {
        "App\\Test\\": "tests",
        "Cake\\Test\\": "./vendor/cakephp/cakephp/tests",
        "Audit\\Test\\": "./plugins/Audit/tests"
    }

1 个答案:

答案 0 :(得分:0)

我在文件中添加了正确的namespace Audit\View\Cell