eventmanger attach problem with zfcuser logout

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

eventmanger attach problem with zfcuser logout

erkinaka
hi,

i'm using zfcuser in my project and i want to attach to logout. i try the code below. but it doesn't work. Could you help me.
Thanks.

My "module.php"

public function onBootstrap(EventManager\Event $e) {
        $sm = $e->getApplication()->getServiceManager();

        $authorize = $sm->get('BjyAuthorizeServiceAuthorize');
        $acl = $authorize->getAcl();
        $role = $authorize->getIdentity();
        \Zend\View\Helper\Navigation::setDefaultAcl($acl);
        \Zend\View\Helper\Navigation::setDefaultRole($role);

        $eventManager = $e->getApplication()->getEventManager();
        $sharedEventManager = $eventManager->getSharedManager(); // Theshared event manager
       
$sharedEventManager->attach('ZfcUser\Controller\UserController', "logout", function($e) {
$sessionManager = new \Zend\Session\SessionManager();
$sessionManager->destroy();
});
..................