本文整理汇总了PHP中Zend\ModuleManager\ModuleEvent::getParam方法的典型用法代码示例。如果您正苦于以下问题:PHP ModuleEvent::getParam方法的具体用法?PHP ModuleEvent::getParam怎么用?PHP ModuleEvent::getParam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\ModuleManager\ModuleEvent
的用法示例。
在下文中一共展示了ModuleEvent::getParam方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initEvents
/**
* Init events
*
* @param \Zend\ModuleManager\ModuleEvent $e
*/
public function initEvents(ModuleEvent $e)
{
$model = $this->serviceLocator->get('Application\\Model\\ModelManager')->getInstance('ActionTracker\\Model\\ActionTrackerBase');
$actions = $model->getActivatedActions();
// bind all activated events
if (count($actions)) {
$eventManager = ActionTrackerEvent::getEventManager();
foreach ($actions as $action) {
$eventManager->attach($action->name, function ($e) use($model, $action) {
if ($model->getModuleInfo('ActionTracker')) {
$model->logAction($action->action_id, $e->getParam('description'), $e->getParam('description_params'));
}
});
}
}
}
示例2: onLoadModulesPost
/**
* Called when the modules are loaded.
*
* @param ModuleEvent $event
*/
public function onLoadModulesPost(ModuleEvent $event)
{
/** @var ServiceManager $serviceManager */
$serviceManager = $event->getParam('ServiceManager');
/** @var EngineInterface $engine */
$engine = $serviceManager->get('phpab.engine');
$engine->start();
}
示例3: onLoadModules
public function onLoadModules(ModuleEvent $event)
{
// /** @var ModuleManager $moduleManager */
// $moduleManager = $event->getTarget();
/** @var ServiceManager $serviceLocator */
$serviceLocator = $event->getParam('ServiceManager');
$serviceConfig = ArrayUtils::merge($this->getConfig(false)['service_manager'], $this->getServiceConfig());
$serviceConfig = new ServiceConfig($serviceConfig);
$serviceConfig->configureServiceManager($serviceLocator);
/** @var \Detail\VarCrypt\Listener\MultiEncryptorListener $encryptorListener */
$encryptorListener = $serviceLocator->get('Detail\\VarCrypt\\Listener\\MultiEncryptorListener');
$encryptorListener->onLoadModules($event);
// $moduleManager->getEventManager()->attachAggregate($encryptorListener);
}
示例4: overrideViewHelperUrl
public function overrideViewHelperUrl(ModuleEvent $e)
{
$serviceLocator = $e->getParam('ServiceManager');
$viewHelperManager = $serviceLocator->get('ViewHelperManager');
// Configure URL view helper with router
$viewHelperManager->setFactory('url', function ($sm) use($serviceLocator) {
$helper = new View\Helper\Url();
$router = \Zend\Console\Console::isConsole() ? 'HttpRouter' : 'Router';
$helper->setRouter($serviceLocator->get($router));
$match = $serviceLocator->get('application')->getMvcEvent()->getRouteMatch();
if ($match instanceof \Zend\Mvc\Router\RouteMatch) {
$helper->setRouteMatch($match);
}
return $helper;
});
}
示例5: onLoadModule
/**
* Merge the config for each module
*
* @param ModuleEvent $e
* @return ConfigListener
*/
public function onLoadModule(ModuleEvent $e)
{
$module = $e->getParam('module');
if (!$module instanceof ConfigProviderInterface && !is_callable(array($module, 'getConfig'))) {
return $this;
}
$config = $module->getConfig();
$this->addConfig($e->getModuleName(), $config);
return $this;
}