2017-03-24 2 views
0

Je migre mon application ZF2 vers ZF3.Exception lors de l'appel de la méthode d'authentification du service d'authentification Zend

Tout en appelant la méthode d'authentification, obtenir cette exception

Une erreur est survenue Une erreur est survenue lors de l'exécution; Veuillez réessayer plus tard. Aucune exception disponible

Voici comment j'appeler la méthode,

public function __construct($authService, $sessionManager, $config) 
{ 
    $this->authService = $authService;//Getting the Zend\Authentication\AuthenticationService object (no error here) 
    $this->sessionManager = $sessionManager; 
    $this->config = $config; 
} 
public function login($email, $password, $rememberMe) 
{ 
    if ($this->authService->getIdentity() != null) { 
     throw new \Exception('Already logged in'); 
    } 

    // Authenticate with login/password. 
    $authAdapter = $this->authService->getAdapter(); 
    $authAdapter->setEmail($email);//abc.gmail.com 
    $authAdapter->setPassword($password);//sha1 password 
    $this->authService->authenticate();//Exception is generating here 
} 

Qu'est-ce que je fais mal?

+0

Dites-nous quelque chose de plus sur le service d'authentification. Cela vient-il du module externe? Ou c'est la classe Zend standard? – SzymonM

+0

@SzymonM C'est une classe Zend standard. L'objet de 'Zend \ Authentication \ AuthenticationService' –

Répondre

0

Votre message d'exception ne suffit pas, vous devriez vérifier php_error.log pour plus de détails.

Je suppose que vous n'êtes pas inscrit Auth Service dans la configuration.

Ainsi, dans config/autoload/global.php ajouter

'service_manager' => [ 
    'invokables' => [ 
     Zend\Authentication\AuthenticationService::class => Zend\Authentication\AuthenticationService::class, 
    ] 
],