开始使用Doctrine处理zf3项目,但遇到了这个问题。
这是我的工厂
public function __invoke(ContainerInterface $container, $requestedName, Array $options = null) {
$authenticationService = $container->get('doctrine.authenticationservice.orm_default');
$entityManager = $container->get('doctrine.entitymanager.orm_default');
return new $requestedName($entityManager, $authenticationService);
}
并在控制器中
public function __construct(EntityManager $em, $auth)
{
$this->entityManager = $em;
$this->authService = $auth;
}
public function loginAction()
{
//...
}
在配置中
'authentication' => [
'orm_default' => [
'object_manager' => 'Doctrine\ORM\EntityManager',
'identity_class' => 'Application\Entity\Users',
'identity_property' => 'username',
'credential_property' => 'password'
],
],
...
但它给出了错误
这条线
$authenticationService = $container->get('doctrine.authenticationservice.orm_default');
给我错误
找不到类“Zend\Session\Container”