zend framework 3 and doctrine authentication

454 views Asked by At

Started working on zf3 project with Doctrine but ran into this problem.

This is my Factory

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);
}

and in controller

public function __construct(EntityManager $em, $auth)
    {
        $this->entityManager = $em;
        $this->authService = $auth;
    }


public function loginAction()
{
    //...
}

in config

'authentication' => [
         'orm_default' => [
             'object_manager' => 'Doctrine\ORM\EntityManager',
             'identity_class' => 'Application\Entity\Users',
             'identity_property' => 'username',
             'credential_property' => 'password'
         ],
     ],
...

but it gives the error

this line

 $authenticationService = $container->get('doctrine.authenticationservice.orm_default');

gives me the error

Class 'Zend\Session\Container' not found

1

There are 1 answers

0
Wilt On BEST ANSWER

Do you have the zend-session module installed? For doctrine authentication to work you need to install this dependency.

It seems the class Zend\Session\Container is unavailable which suggests that this module is not properly installed.