Waqar Haider
Waqar Haider

Reputation: 973

zend framework 3 and doctrine authentication

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

Upvotes: 1

Views: 456

Answers (1)

Wilt
Wilt

Reputation: 44422

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.

Upvotes: 3

Related Questions