public static function init($configuration = array())
{
$smConfig = isset($configuration['service_manager']) ? $configuration['service_manager'] : array();
$listeners = isset($configuration['listeners']) ? $configuration['listeners'] : array();
$serviceManager = new ServiceManager(new Service\ServiceManagerConfig($smConfig));
$serviceManager->setService('ApplicationConfig', $configuration);
$serviceManager->get('ModuleManager')->loadModules();
return $serviceManager->get('Application')->bootstrap($listeners);
}
public function onBootstrap(MvcEvent $e){
$eventManager = $e->getApplication()->getEventManager();
$moduleRouteListener = new ModuleRouteListener();
$moduleRouteListener->attach($eventManager);
}
public function onRoute(MvcEvent $e){
$matches = #e->getRouteMatch();
}
class MvcEvent extends Event{
const event_bootstrap = 'bootstrap';
const event_dispatch = 'dispatch';
const event_render = 'render';
const event_route = 'route';
}
Zend Framework 2 : Event and DI
最新推荐文章于 2019-09-10 17:32:38 发布