public function logoutAction()
    {
        $auth = $this->getServiceLocator()->get('Zend\Authentication\AuthenticationService');
        if ($auth->hasIdentity()) {
            $auth->clearIdentity();
            $sessionManager = new SessionManager();
            $sessionManager->forgetMe();
        }

        return $this->redirect()->toRoute($this->getOptions()->getLogoutRedirectRoute());
    }
public function logoutAction()
    {
        $auth = $this->getServiceLocator()->get('Zend\Authentication\AuthenticationService');
        if ($auth->hasIdentity()) {
            $auth->clearIdentity();
            $sessionManager = new SessionManager();
            $sessionManager->forgetMe();
        }

        return $this->redirect()->toRoute($this->getOptions()->getLogoutRedirectRoute());
    }
public function logoutAction ( ) { $ auth = $ this -> getServiceLocator ( ) -> get ( 'Zend\Authentication\AuthenticationService' ) ; if ( $ auth -> hasIdentity ( ) ) { $ auth -> clearIdentity ( ) ; $ sessionManager = new SessionManager ( ) ; $ sessionManager -> forgetMe ( ) ; } return $ this -> redirect ( ) -> toRoute ( $ this -> getOptions ( ) -> getLogoutRedirectRoute ( ) ) ; }
Log out action

The method destroys session for a logged user

@return redirect to specific action
Log out action