Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Commit

Permalink
Changed the previous fix as per pull req #2350 discussion
Browse files Browse the repository at this point in the history
  • Loading branch information
bedeabza authored and weierophinney committed Sep 14, 2012
1 parent 48ee1a8 commit 4c8f990
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions library/Zend/ModuleManager/Listener/LocatorRegistrationListener.php
Expand Up @@ -67,26 +67,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);
}

/**
Expand Down

0 comments on commit 4c8f990

Please sign in to comment.