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

Commit

Permalink
Merge branch 'add-consistency-with-event-name' of https://github.com/…
Browse files Browse the repository at this point in the history
  • Loading branch information
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/Listener/LocatorRegistrationListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Zend\EventManager\ListenerAggregateInterface;
use Zend\ModuleManager\Feature\LocatorRegisteredInterface;
use Zend\ModuleManager\ModuleEvent;
use Zend\Mvc\MvcEvent;

/**
* Locator registration listener
Expand Down Expand Up @@ -67,7 +68,7 @@ public function onLoadModulesPost(Event $e)
$events = $moduleManager->getEventManager()->getSharedManager();

// Shared instance for module manager
$events->attach('Zend\Mvc\Application', 'bootstrap', function ($e) use ($moduleManager) {
$events->attach('Zend\Mvc\Application', MvcEvent::EVENT_BOOTSTRAP, function ($e) use ($moduleManager) {
$moduleClassName = get_class($moduleManager);
$application = $e->getApplication();
$services = $application->getServiceManager();
Expand All @@ -81,7 +82,7 @@ public function onLoadModulesPost(Event $e)
}

// Attach to the bootstrap event if there are modules we need to process
$events->attach('Zend\Mvc\Application', 'bootstrap', array($this, 'onBootstrap'), 1000);
$events->attach('Zend\Mvc\Application', MvcEvent::EVENT_BOOTSTRAP, array($this, 'onBootstrap'), 1000);
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/Listener/OnBootstrapListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

use Zend\ModuleManager\Feature\BootstrapListenerInterface;
use Zend\ModuleManager\ModuleEvent;
use Zend\Mvc\MvcEvent;

/**
* Autoloader listener
Expand Down Expand Up @@ -39,6 +40,6 @@ public function __invoke(ModuleEvent $e)
$moduleManager = $e->getTarget();
$events = $moduleManager->getEventManager();
$sharedEvents = $events->getSharedManager();
$sharedEvents->attach('Zend\Mvc\Application', 'bootstrap', array($module, 'onBootstrap'));
$sharedEvents->attach('Zend\Mvc\Application', MvcEvent::EVENT_BOOTSTRAP, array($module, 'onBootstrap'));
}
}
2 changes: 1 addition & 1 deletion test/TestAsset/MockApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@ public function bootstrap()
$event = new MvcEvent();
$event->setApplication($this);
$event->setTarget($this);
$this->getEventManager()->trigger('bootstrap', $event);
$this->getEventManager()->trigger(MvcEvent::EVENT_BOOTSTRAP, $event);
}
}

0 comments on commit 1befc2e

Please sign in to comment.