CakePHP 3错误生​​成器插件:[Cake \ Core \ Exception \ MissingPluginException]无法找到插件

时间:2017-07-30 22:51:30

标签: php cakephp plugins cakephp-3.0

关联我的问题:https://github.com/cakephp/cakephp/issues/10966

你做了什么

由控制台插件示例创建。

.\bin\cake bake plugin EOM/shop
.\bin\cake bake controller hola -p EOM/shop

//改变ok bootstrap.php

Plugin::load('EOM/shop', ['bootstrap' => false, 'routes' => true]);

路由器插件:

Router::plugin(
    'EOM/shop',
    ['path' => '/e-o-m/shop'],
    function (RouteBuilder $routes) {
        $routes->fallbacks(DashedRoute::class);
    }
);

打印:DebugKit

enter image description here

打印:插件中的My Tree文件夹

enter image description here

发生了什么

浏览器出错:"发生内部服务器错误"

输出文件error.log

2017-07-30 21:33:13 Error: [Cake\Core\Exception\MissingPluginException] Plugin EOM/Shop could not be found.
Exception Attributes: array (
  'plugin' => 'EOM/Shop',
)
Request URL: /e-o-m/shop/hola
Stack Trace:
#0 D:\www\app.aptitud.local\www\vendor\cakephp\cakephp\src\Core\App.php(190): Cake\Core\Plugin::classPath('EOM/Shop')
#1 D:\www\app.aptitud.local\www\vendor\cakephp\cakephp\src\View\View.php(1269): Cake\Core\App::path('Template', 'EOM/Shop')
#2 D:\www\app.aptitud.local\www\vendor\cakephp\cakephp\src\View\View.php(1087): Cake\View\View->_paths('EOM/Shop')
#3 D:\www\app.aptitud.local\www\vendor\cakephp\cakephp\src\View\View.php(592): Cake\View\View->_getViewFileName('Error\\error500')
#4 D:\www\app.aptitud.local\www\vendor\cakephp\cakephp\src\Error\ExceptionRenderer.php(364): Cake\View\View->render('error500', 'error')
#5 D:\www\app.aptitud.local\www\vendor\cakephp\cakephp\src\Error\ExceptionRenderer.php(341): Cake\Error\ExceptionRenderer->_outputMessageSafe('error500')
#6 D:\www\app.aptitud.local\www\vendor\cakephp\cakephp\src\Error\ExceptionRenderer.php(200): Cake\Error\ExceptionRenderer->_outputMessage('missingControll...')
#7 D:\www\app.aptitud.local\www\vendor\cakephp\cakephp\src\Error\Middleware\ErrorHandlerMiddleware.php(110): Cake\Error\ExceptionRenderer->render()
#8 D:\www\app.aptitud.local\www\vendor\cakephp\cakephp\src\Error\Middleware\ErrorHandlerMiddleware.php(94): Cake\Error\Middleware\ErrorHandlerMiddleware->handleException(Object(Cake\Routing\Exception\MissingControllerException), Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#9 D:\www\app.aptitud.local\www\vendor\cakephp\cakephp\src\Http\Runner.php(65): Cake\Error\Middleware\ErrorHandlerMiddleware->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response), Object(Cake\Http\Runner))
#10 D:\www\app.aptitud.local\www\vendor\cakephp\cakephp\src\Http\Runner.php(51): Cake\Http\Runner->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#11 D:\www\app.aptitud.local\www\vendor\cakephp\cakephp\src\Http\Server.php(80): Cake\Http\Runner->run(Object(Cake\Http\MiddlewareQueue), Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#12 D:\www\app.aptitud.local\www\webroot\index.php(37): Cake\Http\Server->run()
#13 {main}

您期望发生什么

加载我的课程我的插件子文件夹 / app / plugins / EOM / Shop / / app / plugins / MyCompany / Shop /

1 个答案:

答案 0 :(得分:0)

检测问题, 在创建插件和控制器时,解决方案很简单。因为它很容易因为我在开头总是有大写的名字。

gener修复示例:

.\bin\cake bake plugin EOM/shop
.\bin\cake bake controller hola -p EOM/shop

无错误示例:

.\bin\cake bake plugin EOM/Shop
.\bin\cake bake controller Hola -p EOM/Shop

并且没有问题加载类更改bootstrap.php

Plugin::load('EOM/Shop', ['autoload' => true, 'bootstrap' => false, 'routes' => true]);

或者在控制台中执行,而不是在bootstrap.php中添加更改[' autoload' =>是的,......]:

php composer.phar dumpautoload