本文整理汇总了PHP中Zend\EventManager\Event::getApplication方法的典型用法代码示例。如果您正苦于以下问题:PHP Event::getApplication方法的具体用法?PHP Event::getApplication怎么用?PHP Event::getApplication使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\EventManager\Event
的用法示例。
在下文中一共展示了Event::getApplication方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onBootstrap
public function onBootstrap(Event $e)
{
$sm = $e->getApplication()->getServiceManager();
$em = $sm->get('doctrine.entitymanager.orm_default');
$geoname = $sm->get('geoname');
$geoname->setEm($em)->registerCron();
}
示例2: onBootstrap
public function onBootstrap(Event $e)
{
$app = $e->getApplication();
Utility::setSM($app->getServiceManager());
TransactionUtility::setSM($app->getServiceManager());
UnitCalcUtility::setSM($app->getServiceManager());
}
示例3: onBootstrap
public function onBootstrap(Event $e)
{
$sm = $e->getApplication()->getServiceManager();
$em = $sm->get('doctrine.entitymanager.orm_default');
$vcard = $sm->get('vcard');
$vcard->setEm($em);
}
示例4: onBootstrap
public function onBootstrap(Event $event)
{
$application = $event->getApplication();
$serviceManager = $application->getServiceManager();
$view = $serviceManager->get('view');
$twigStrategy = $serviceManager->get('ViewTwigStrategy');
$view->getEventManager()->attach($twigStrategy, 100);
}
示例5: loadConfiguration
/**
* Load configuration
* Change information to the ZF2 headTitle helper with informations of the plugin
* @param Event $e
*/
public function loadConfiguration(Event $e)
{
$application = $e->getApplication();
$sm = $application->getServiceManager();
$viewHelperManager = $sm->get('viewHelperManager');
$plugin = $sm->get('ControllerPluginManager')->get('HeadTitle');
$headTitleHelper = $viewHelperManager->get('headTitle');
$headTitleHelper->set($plugin->getTitle());
}
示例6: onBootstrap
/**
* Bootstrap listener
*
* This is ran during the MVC bootstrap event because it requires access to
* the DI container.
*
* @TODO: Check the application / locator / etc a bit better to make sure
* the env looks how we're expecting it to?
* @param Event $e
* @return void
*/
public function onBootstrap(Event $e)
{
$application = $e->getApplication();
$services = $application->getServiceManager();
foreach ($this->modules as $module) {
$moduleClassName = get_class($module);
if (!$services->has($moduleClassName)) {
$services->setService($moduleClassName, $module);
}
}
}
示例7: onBootstrap
public function onBootstrap(Event $e)
{
$app = $e->getApplication();
$app->getEventManager()->attach('dispatch', array($this, 'setLayout'), -100);
}
示例8: onBootstrap
public function onBootstrap(Event $e)
{
$application = $e->getApplication();
$serviceManager = $application->getServiceManager();
$this->setCacheAdapterToMapper($serviceManager);
}