Browse files

Changed the previous fix as per pull req #2350 discussion

  • Loading branch information...
1 parent 7044bb1 commit 41c67b101867945fed52d59bc10a20c5f81542ec @bedeabza committed Sep 14, 2012
Showing with 14 additions and 14 deletions.
  1. +14 −14 library/Zend/ModuleManager/Listener/LocatorRegistrationListener.php
View
28 library/Zend/ModuleManager/Listener/LocatorRegistrationListener.php
@@ -66,26 +66,26 @@ public function onLoadModulesPost(Event $e)
$moduleManager = $e->getTarget();
$events = $moduleManager->getEventManager()->getSharedManager();
- if(false !== $events){
- // Shared instance for module manager
- $events->attach('Zend\Mvc\Application', 'bootstrap', function ($e) use ($moduleManager) {
- $moduleClassName = get_class($moduleManager);
- $application = $e->getApplication();
- $services = $application->getServiceManager();
- if (!$services->has($moduleClassName)) {
- $services->setService($moduleClassName, $moduleManager);
- }
- }, 1000);
+ if(!$events){
+ return;
}
+ // Shared instance for module manager
+ $events->attach('Zend\Mvc\Application', 'bootstrap', function ($e) use ($moduleManager) {
+ $moduleClassName = get_class($moduleManager);
+ $application = $e->getApplication();
+ $services = $application->getServiceManager();
+ if (!$services->has($moduleClassName)) {
+ $services->setService($moduleClassName, $moduleManager);
+ }
+ }, 1000);
+
if (0 === count($this->modules)) {
return;
}
- if(false !== $events){
- // Attach to the bootstrap event if there are modules we need to process
- $events->attach('Zend\Mvc\Application', 'bootstrap', array($this, 'onBootstrap'), 1000);
- }
+ // Attach to the bootstrap event if there are modules we need to process
+ $events->attach('Zend\Mvc\Application', 'bootstrap', array($this, 'onBootstrap'), 1000);
}
/**

0 comments on commit 41c67b1

Please sign in to comment.