Skip to content

Instantly share code, notes, and snippets.

@bakura10
Created July 8, 2012 18:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bakura10/3072082 to your computer and use it in GitHub Desktop.
Save bakura10/3072082 to your computer and use it in GitHub Desktop.
Strange problem
// 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