Heya! There's a conceptual problem in this approach: your application is still bootstrapping! It is _NOT_ yet ready, nor the module can be loaded at this late stage of initialization.
Therefore, the services required for authentication may not yet be ready, and the identity may always be null depending on various circumstances. Additionally, your `chat` module's configuration cannot be cached this way, which is quite a performance loss. Instead of trying to programmatically enable features in your application, why don't you just disable them later on through a listener triggered when chat initialization is attempted? Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ On 14 May 2013 20:31, Maverock24 [via Zend Framework Community] < [email protected]> wrote: > Hey all, > > i am trying to load a modul depending on my log in status coming from a > service. > I use the application modul.php to decide if the modul is loaded. > > .... > > public function onBootstrap(\Zend\Mvc\MvcEvent $e){ > // ... > $isloggedIn = > $e->getApplication()->getServiceManager->get('zend_user_authenticate')->hasIdentity(); > > > If ($isloggedIn) > { > > $e->getApplication()->getServiceManager->get('ModuleManager')->loadModule('Chat'); > > } > > .... > > I do not get any error message but the modul is just not loaded. > > Is there a better way to load modules depending on results/events ? > > Thanx. > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > > http://zend-framework-community.634137.n4.nabble.com/zf2-Load-module-dynamically-depending-log-in-status-tp4660018.html > To start a new topic under Zend Framework, email > [email protected] > To unsubscribe from Zend Framework Community, click > here<http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=634137&code=b2NyYW1pdXNAZ21haWwuY29tfDYzNDEzN3wxNzE0OTI1MTk4> > . > NAML<http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Re-zf2-Load-module-dynamically-depending-log-in-status-tp4660019.html Sent from the Zend Framework mailing list archive at Nabble.com.
