Created
July 8, 2012 18:04
-
-
Save bakura10/3072082 to your computer and use it in GitHub Desktop.
Strange problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In my controller : | |
/** | |
* @return array | |
*/ | |
public function logoutAction() | |
{ | |
$this->getUserService()->logout(); | |
return $this->redirect()->toRoute('home'); | |
} | |
/** | |
* @return UserService | |
*/ | |
protected function getUserService() | |
{ | |
if (!$this->userService) { | |
$this->userService = $this->getServiceLocator()->get('member.service.user'); | |
} | |
return $this->userService; | |
} | |
Where logout : | |
/** | |
* @return void | |
*/ | |
public function logout() | |
{ | |
$this->getAuthenticationService()->clearIdentity(); | |
} | |
Where getAuthenticationService() : | |
/** | |
* @return AuthenticationService | |
*/ | |
public function getAuthenticationService() | |
{ | |
if (!$this->authenticationService) { | |
$this->authenticationService = $this->serviceManager->get('common.service.authentication'); | |
} | |
return $this->authenticationService; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment