无法初始化供应商中zf2 my模块的致命错误

时间:2014-10-19 14:56:51

标签: php module zend-framework2

我尝试在供应商中创建自己的模块:vendor / mylib / zf2-auth_manager

错误:

致命错误:未捕获的异常' Zend \ ModuleManager \ Exception \ RuntimeException'消息'模块(MyLib \ ZF2 \ AuthManager)无法初始化。'在第189行的/home/sandbox/public_html/vendor/zendframework/zendframework/library/Zend/ModuleManager/ModuleManager.php

Zend \ ModuleManager \ Exception \ RuntimeException:无法初始化模块(MyLib \ ZF2 \ AuthManager)。在第189行的/home/sandbox/public_html/vendor/zendframework/zendframework/library/Zend/ModuleManager/ModuleManager.php

Module.php:

namespace MyLib\ZF2\AuthManager;

use Zend\ModuleManager\Feature\AutoloaderProviderInterface;
use Zend\ModuleManager\Feature\ConfigProviderInterface;

class Module implements AutoloaderProviderInterface, ConfigProviderInterface
{
    public function getAutoloaderConfig()
    {
        return array(
            'Zend\Loader\ClassMapAutoloader' => array(
                __DIR__ . '/autoload_classmap.php',
            ),
            'Zend\Loader\StandardAutoloader' => array(
                'namespaces' => array(
                    __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
                ),
            ),
        );
    }

    public function getConfig()
    {
        return include __DIR__ . '/config/module.config.php';
    }
}

module.config.php:

return array(
    'controllers' => array(
        'invokables' => array(
            'MyLib\ZF2\AuthManager\Controller\DispatchAuthManager'=> 'MyLib\ZF2\AuthManager\Controller\DispatchAuthManagerController',
        ),
    ),
    'router' => array(
        'routes' => array(
            'MyLib\ZF2\AuthManager\routes' => array(
                'type'    => 'segment',
                'options' => array(
                    'route'    => '/authManager[/][:action][/:id]',
                    'constraints' => array(
                        'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
                        'id'     => '[0-9]+',
                    ),
                    'defaults' => array(
                        'controller' => 'MyLib\ZF2\AuthManager\Controller\DispatchAuthManager',
                        'action'     => 'index',
                    ),
                ),
            ),
        ),
    ),
    'view_manager' => array(
        'template_path_stack' => array(
            'MyLib\ZF2\AuthManager'=>__DIR__ . '/../view',
        ),
    ),
);

我尝试在init_autoloader.php

中设置我的命名空间
Zend\Loader\AutoloaderFactory::factory(
    array(
        'Zend\Loader\StandardAutoloader' => array(
            'autoregister_zf' => true,
            'namespaces'=>array(
                'MyLib\ZF2\AuthManager'=> __DIR__ . '/vendor/mylib/zf2-auth_manager'
            ),
        )
    )
);

但没有变化我认为它找不到我的模块,但是application.module.php看起来不错

'modules' => array(
    'MyLib\ZF2\AuthManager',
    'Application',
),

我希望有人会看到我看不到的东西。

0 个答案:

没有答案