本文整理匯總了PHP中Zend\ModuleManager\ModuleManager::setEvent方法的典型用法代碼示例。如果您正苦於以下問題:PHP ModuleManager::setEvent方法的具體用法?PHP ModuleManager::setEvent怎麽用?PHP ModuleManager::setEvent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend\ModuleManager\ModuleManager
的用法示例。
在下文中一共展示了ModuleManager::setEvent方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: createService
/**
* Creates and returns the module manager
*
* Instantiates the default module listeners, providing them configuration
* from the "module_listener_options" key of the ApplicationConfig
* service. Also sets the default config glob path.
*
* Module manager is instantiated and provided with an EventManager, to which
* the default listener aggregate is attached. The ModuleEvent is also created
* and attached to the module manager.
*
* @param ServiceLocatorInterface $serviceLocator
* @return ModuleManager
*/
public function createService(ServiceLocatorInterface $serviceLocator)
{
if (!$serviceLocator->has('ServiceListener')) {
$serviceLocator->setFactory('ServiceListener', 'Zend\\Mvc\\Service\\ServiceListenerFactory');
}
$configuration = $serviceLocator->get('ApplicationConfig');
$listenerOptions = new ListenerOptions($configuration['module_listener_options']);
$defaultListeners = new DefaultListenerAggregate($listenerOptions);
$serviceListener = $serviceLocator->get('ServiceListener');
$serviceListener->addServiceManager($serviceLocator, 'service_manager', 'Zend\\ModuleManager\\Feature\\ServiceProviderInterface', 'getServiceConfig');
$serviceListener->addServiceManager('ControllerLoader', 'controllers', 'Zend\\ModuleManager\\Feature\\ControllerProviderInterface', 'getControllerConfig');
$serviceListener->addServiceManager('ControllerPluginManager', 'controller_plugins', 'Zend\\ModuleManager\\Feature\\ControllerPluginProviderInterface', 'getControllerPluginConfig');
$serviceListener->addServiceManager('ViewHelperManager', 'view_helpers', 'Zend\\ModuleManager\\Feature\\ViewHelperProviderInterface', 'getViewHelperConfig');
$serviceListener->addServiceManager('ValidatorManager', 'validators', 'Zend\\ModuleManager\\Feature\\ValidatorProviderInterface', 'getValidatorConfig');
$serviceListener->addServiceManager('FilterManager', 'filters', 'Zend\\ModuleManager\\Feature\\FilterProviderInterface', 'getFilterConfig');
$serviceListener->addServiceManager('FormElementManager', 'form_elements', 'Zend\\ModuleManager\\Feature\\FormElementProviderInterface', 'getFormElementConfig');
$serviceListener->addServiceManager('RoutePluginManager', 'route_manager', 'Zend\\ModuleManager\\Feature\\RouteProviderInterface', 'getRouteConfig');
$serviceListener->addServiceManager('SerializerAdapterManager', 'serializers', 'Zend\\ModuleManager\\Feature\\SerializerProviderInterface', 'getSerializerConfig');
$serviceListener->addServiceManager('HydratorManager', 'hydrators', 'Zend\\ModuleManager\\Feature\\HydratorProviderInterface', 'getHydratorConfig');
$serviceListener->addServiceManager('InputFilterManager', 'input_filters', 'Zend\\ModuleManager\\Feature\\InputFilterProviderInterface', 'getInputFilterConfig');
$serviceListener->addServiceManager('LogProcessorManager', 'log_processors', 'Zend\\ModuleManager\\Feature\\LogProcessorProviderInterface', 'getLogProcessorConfig');
$serviceListener->addServiceManager('LogWriterManager', 'log_writers', 'Zend\\ModuleManager\\Feature\\LogWritersProviderInterface', 'getLogWriterConfig');
$events = $serviceLocator->get('EventManager');
$events->attach($defaultListeners);
$events->attach($serviceListener);
$moduleEvent = new ModuleEvent();
$moduleEvent->setParam('ServiceManager', $serviceLocator);
$moduleManager = new ModuleManager($configuration['modules'], $events);
$moduleManager->setEvent($moduleEvent);
return $moduleManager;
}
示例2: createService
/**
* Creates and returns the module manager
*
* Instantiates the default module listeners, providing them configuration
* from the "module_listener_options" key of the ApplicationConfig
* service. Also sets the default config glob path.
*
* Module manager is instantiated and provided with an EventManager, to which
* the default listener aggregate is attached. The ModuleEvent is also created
* and attached to the module manager.
*
* @param ServiceLocatorInterface $serviceLocator
* @return ModuleManager
*/
public function createService(ServiceLocatorInterface $serviceLocator)
{
if (!$serviceLocator->has('ServiceListener')) {
$serviceLocator->setFactory('ServiceListener', 'HumusMvc\\Service\\ServiceListenerFactory');
}
if (!$serviceLocator->has('Zf1MvcListener')) {
$serviceLocator->setFactory('Zf1MvcListener', 'HumusMvc\\Service\\Zf1MvcListenerFactory');
}
$configuration = $serviceLocator->get('ApplicationConfig');
$listenerOptions = new ListenerOptions($configuration['module_listener_options']);
$defaultListeners = new DefaultListenerAggregate($listenerOptions);
$serviceListener = $serviceLocator->get('ServiceListener');
$serviceListener->addServiceManager($serviceLocator, 'service_manager', 'Zend\\ModuleManager\\Feature\\ServiceProviderInterface', 'getServiceConfig');
$serviceListener->addServiceManager('ViewHelperManager', 'view_helpers', 'Zend\\ModuleManager\\Feature\\ViewHelperProviderInterface', 'getViewHelperConfig');
$serviceListener->addServiceManager('ActionHelperManager', 'action_helpers', 'HumusMvc\\ModuleManager\\Feature\\ActionHelperProviderInterface', 'getActionHelperConfig');
$events = $serviceLocator->get('EventManager');
$events->attach($defaultListeners);
$events->attach($serviceListener);
$sharedEvents = $events->getSharedManager();
$sharedEvents->attach('HumusMvc\\Application', 'bootstrap', new LocaleListener());
$moduleEvent = new ModuleEvent();
$moduleEvent->setParam('ServiceManager', $serviceLocator);
$moduleManager = new ModuleManager($configuration['modules'], $events);
$moduleManager->setEvent($moduleEvent);
return $moduleManager;
}
示例3: createService
/**
* Creates and returns the module manager
*
* Instantiates the default module listeners, providing them configuration
* from the "module_listener_options" key of the ApplicationConfig
* service. Also sets the default config glob path.
*
* Module manager is instantiated and provided with an EventManager, to which
* the default listener aggregate is attached. The ModuleEvent is also created
* and attached to the module manager.
*
* @param ServiceLocatorInterface $serviceLocator
* @return ModuleManager
*/
public function createService(ServiceLocatorInterface $serviceLocator)
{
if (!$serviceLocator->has('ServiceListener')) {
$serviceLocator->setFactory('ServiceListener', 'Console\\Service\\ServiceListenerFactory');
}
$configuration = $serviceLocator->get('ApplicationConfig');
$listenerOptions = new ListenerOptions($configuration['module_listener_options']);
$defaultListeners = new DefaultListenerAggregate($listenerOptions);
$serviceListener = $serviceLocator->get('ServiceListener');
$serviceListener->addServiceManager($serviceLocator, 'service_manager', 'Zend\\ModuleManager\\Feature\\ServiceProviderInterface', 'getServiceConfig');
$serviceListener->addServiceManager('ValidatorManager', 'validators', 'Zend\\ModuleManager\\Feature\\ValidatorProviderInterface', 'getValidatorConfig');
$serviceListener->addServiceManager('FilterManager', 'filters', 'Zend\\ModuleManager\\Feature\\FilterProviderInterface', 'getFilterConfig');
$serviceListener->addServiceManager('SerializerAdapterManager', 'serializers', 'Zend\\ModuleManager\\Feature\\SerializerProviderInterface', 'getSerializerConfig');
$serviceListener->addServiceManager('SerializerAdapterManager', 'serializers', 'Zend\\ModuleManager\\Feature\\SerializerProviderInterface', 'getSerializerConfig');
$serviceListener->addServiceManager('HydratorManager', 'hydrators', 'Zend\\ModuleManager\\Feature\\HydratorProviderInterface', 'getHydratorConfig');
$serviceListener->addServiceManager('InputFilterManager', 'input_filters', 'Zend\\ModuleManager\\Feature\\InputFilterProviderInterface', 'getInputFilterConfig');
$events = $serviceLocator->get('EventManager');
$events->attach($defaultListeners);
$events->attach($serviceListener);
$moduleEvent = new ModuleEvent();
$moduleEvent->setParam('ServiceManager', $serviceLocator);
$moduleManager = new ModuleManager($configuration['modules'], $events);
$moduleManager->setEvent($moduleEvent);
return $moduleManager;
}
示例4: createService
/**
* Creates and returns the module manager
*
* Instantiates the default module listeners, providing them configuration
* from the "module_listener_options" key of the ApplicationConfiguration
* service. Also sets the default config glob path.
*
* Module manager is instantiated and provided with an EventManager, to which
* the default listener aggregate is attached. The ModuleEvent is also created
* and attached to the module manager.
*
* @param ServiceLocatorInterface $serviceLocator
* @return ModuleManager
*/
public function createService(ServiceLocatorInterface $serviceLocator)
{
$configuration = $serviceLocator->get('ApplicationConfiguration');
$listenerOptions = new ListenerOptions($configuration['module_listener_options']);
$defaultListeners = new DefaultListenerAggregate($listenerOptions);
$serviceListener = new ServiceListener($serviceLocator, $this->defaultServiceConfiguration);
$serviceListener->addServiceManager($serviceLocator, 'service_manager', 'Zend\\ModuleManager\\Feature\\ServiceProviderInterface', 'getServiceConfiguration');
$serviceListener->addServiceManager('ControllerLoader', 'controllers', 'Zend\\ModuleManager\\Feature\\ControllerProviderInterface', 'getControllerConfiguration');
$serviceListener->addServiceManager('ControllerPluginManager', 'controller_plugins', 'Zend\\ModuleManager\\Feature\\ControllerPluginProviderInterface', 'getControllerPluginConfiguration');
$serviceListener->addServiceManager('ViewHelperManager', 'view_helpers', 'Zend\\ModuleManager\\Feature\\ViewHelperProviderInterface', 'getViewHelperConfiguration');
$events = $serviceLocator->get('EventManager');
$events->attach($defaultListeners);
$events->attach($serviceListener);
$moduleEvent = new ModuleEvent();
$moduleEvent->setParam('ServiceManager', $serviceLocator);
$moduleManager = new ModuleManager($configuration['modules'], $events);
$moduleManager->setEvent($moduleEvent);
return $moduleManager;
}
示例5: __invoke
/**
* Creates and returns the module manager
*
* Instantiates the default module listeners, providing them configuration
* from the "module_listener_options" key of the ApplicationConfig
* service. Also sets the default config glob path.
*
* Module manager is instantiated and provided with an EventManager, to which
* the default listener aggregate is attached. The ModuleEvent is also created
* and attached to the module manager.
*
* @param ContainerInterface $container
* @param string $name
* @param null|array $options
* @return ModuleManager
*/
public function __invoke(ContainerInterface $container, $name, array $options = null)
{
$configuration = $container->get('ApplicationConfig');
$listenerOptions = new ListenerOptions($configuration['module_listener_options']);
$defaultListeners = new DefaultListenerAggregate($listenerOptions);
$serviceListener = $container->get('ServiceListener');
$serviceListener->addServiceManager($container, 'service_manager', 'Zend\\ModuleManager\\Feature\\ServiceProviderInterface', 'getServiceConfig');
$serviceListener->addServiceManager('ControllerManager', 'controllers', 'Zend\\ModuleManager\\Feature\\ControllerProviderInterface', 'getControllerConfig');
$serviceListener->addServiceManager('ControllerPluginManager', 'controller_plugins', 'Zend\\ModuleManager\\Feature\\ControllerPluginProviderInterface', 'getControllerPluginConfig');
$serviceListener->addServiceManager('ViewHelperManager', 'view_helpers', 'Zend\\ModuleManager\\Feature\\ViewHelperProviderInterface', 'getViewHelperConfig');
$serviceListener->addServiceManager('RoutePluginManager', 'route_manager', 'Zend\\ModuleManager\\Feature\\RouteProviderInterface', 'getRouteConfig');
$events = $container->get('EventManager');
$defaultListeners->attach($events);
$serviceListener->attach($events);
$moduleEvent = new ModuleEvent();
$moduleEvent->setParam('ServiceManager', $container);
$moduleManager = new ModuleManager($configuration['modules'], $events);
$moduleManager->setEvent($moduleEvent);
return $moduleManager;
}