在我将身份验证服务名称从"orm_default"更改为"admin"之前,它已经成功工作,这是必要的,因为我有更多的模块使用更多的身份验证服务。
问题是我得到了以下错误:
Fatal error: Uncaught exception 'ZendServiceManagerExceptionServiceNotFoundException' with message 'ZendServiceManagerServiceManager::get was unable to fetch or create an instance for doctrine.authenticationservice.admin'
我的模块.config.php
'doctrine' => array
(
'driver' => array
(
__NAMESPACE__ . '_driver' => array
(
'class' => 'DoctrineORMMappingDriverAnnotationDriver',
'cache' => 'array',
'paths' => array(__DIR__ . '/../src/' . __NAMESPACE__ . '/Entity')
),
'orm_default' => array
(
'drivers' => array
(
__NAMESPACE__ . 'Entity' => __NAMESPACE__ . '_driver'
),
)
),
'authentication' => array
(
'admin' => array
(
'object_manager' => 'DoctrineORMEntityManager',
'identity_class' => __NAMESPACE__ . 'EntityUser',
'identity_property' => 'email',
'credential_property' => 'password',
'credentialCallable' => __NAMESPACE__ . 'ModelUser::hashPassword'
),
),
),
My Module.php
public function getServiceConfig()
{
return array
(
'factories' => array
(
'AdminAuth' => function($sm)
{
return $sm->get('doctrine.authenticationservice.admin');
},
'AdminFormAuthLogin' => function($sm)
{
return new FormAuthLogin();
},
),
);
}
它被确认为一个错误:https://github.com/doctrine/DoctrineORMModule/issues/291
根据条令模块源文件中的一条评论,它计划在1.0中修复。在此期间,您可以在应用程序的任何module.config.php文件中使用它,如下所示:
'authentication' =>
[
'application' =>
[
'object_manager' => 'DoctrineORMEntityManager',
'identity_class' => 'ApplicationEntityCustomer',
'identity_property' => 'email',
'credential_property' => 'password',
'credentialCallable' => 'ApplicationEntityCustomer::hashPassword'
],
],
'authenticationadapter' =>
[
'application' => true,
],
'authenticationstorage' =>
[
'application' => true,
],
'authenticationservice' =>
[
'application' => true,
]
我在做项目时也遇到了同样的问题。在我的*ss工作了两个晚上后,我在阅读后简单地重新安装了条令orm模块,就解决了这个问题https://github.com/doctrine/DoctrineORMModule,"注册服务名称"部分。这仅仅意味着条令orm模块没有正确安装,或者没有安装。