当前位置: 首页>>代码示例>>PHP>>正文


PHP EventInterface::getApplication方法代码示例

本文整理汇总了PHP中Zend\EventManager\EventInterface::getApplication方法的典型用法代码示例。如果您正苦于以下问题:PHP EventInterface::getApplication方法的具体用法?PHP EventInterface::getApplication怎么用?PHP EventInterface::getApplication使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\EventManager\EventInterface的用法示例。


在下文中一共展示了EventInterface::getApplication方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: onBootstrap

 public function onBootstrap(EventInterface $e)
 {
     $this->oServiceLocator = $e->getApplication()->getServiceManager();
     $eventManager = $e->getApplication()->getEventManager();
     $moduleRouteListener = new ModuleRouteListener();
     $moduleRouteListener->attach($eventManager);
 }
开发者ID:creativewild,项目名称:TS3UI,代码行数:7,代码来源:Module.php

示例2: onBootstrap

 public function onBootstrap(\Zend\EventManager\EventInterface $e)
 {
     /* @var $e \Zend\Mvc\MvcEvent */
     $eventManager = $e->getApplication()->getEventManager();
     $sm = $e->getApplication()->getServiceManager();
     $translator = $sm->get('MvcTranslator');
     \Zend\Validator\AbstractValidator::setDefaultTranslator($translator);
 }
开发者ID:bioub,项目名称:Formation_ZF2_Adista_201602,代码行数:8,代码来源:Module.php

示例3: onBootstrap

 /**
  * Attach the module to the main MVC event
  *
  * @param MvcEvent $e
  */
 public function onBootstrap(EventInterface $event)
 {
     $serviceManager = $event->getApplication()->getServiceManager();
     $this->config = $serviceManager->get('config');
     $eventManager = $event->getApplication()->getEventManager();
     $eventManager->attach(MvcEvent::EVENT_DISPATCH, array($this, 'preDispatch'), 100);
     $serviceManager->setService('targetConfig', new ArrayObject($this->config['zsapi']['target']));
 }
开发者ID:Karl-Dawson,项目名称:ZendServerWebApiModule,代码行数:13,代码来源:Module.php

示例4: onBootstrap

 public function onBootstrap(EventInterface $e)
 {
     $e->getApplication()->getServiceManager()->get('translator');
     $eventManager = $e->getApplication()->getEventManager();
     $moduleRouteListener = new ModuleRouteListener();
     $moduleRouteListener->attach($eventManager);
     $this->initConfig($e);
 }
开发者ID:sebaxplace,项目名称:skilla-local,代码行数:8,代码来源:Module.php

示例5: onBootstrap

 /**
  * {@inheritdoc}
  */
 public function onBootstrap(EventInterface $e)
 {
     $this->services = $e->getApplication()->getServiceManager();
     $eventManager = $e->getApplication()->getEventManager();
     $eventManager->attach(MvcEvent::EVENT_DISPATCH, [$this, 'onDispatch']);
     $eventManager->attach(MvcEvent::EVENT_RENDER, [$this, 'onRender']);
     $moduleRouteListener = new ModuleRouteListener();
     $moduleRouteListener->attach($eventManager);
 }
开发者ID:jkhaled,项目名称:LearnZF2,代码行数:12,代码来源:Module.php

示例6: onBootstrap

 public function onBootstrap(EventInterface $e)
 {
     $eventManager = $e->getApplication()->getEventManager();
     $serviceManager = $e->getApplication()->getServiceManager();
     // Listener have only sense when request is via http.
     if (!Console::isConsole()) {
         $eventManager->attach(new AssetRouteListener());
     }
 }
开发者ID:shadowfax,项目名称:zf2-asset-manager,代码行数:9,代码来源:Module.php

示例7: onBootstrap

 /**
  * @param EventInterface $e
  *
  * @return array|void
  * @throws \Zend\ServiceManager\Exception\ServiceNotFoundException
  */
 public function onBootstrap(EventInterface $e)
 {
     /** @var MvcEvent $e */
     $eventManager = $e->getApplication()->getEventManager();
     $moduleRouteListener = new ModuleRouteListener();
     $moduleRouteListener->attach($eventManager);
     $sl = $e->getApplication()->getServiceManager();
     EntityManagerFactory::setDefaultServiceLocator($sl);
 }
开发者ID:old-town,项目名称:workflow-doctrine-zf2,代码行数:15,代码来源:Module.php

示例8: onBootstrap

 public function onBootstrap(EventInterface $e)
 {
     /* @var $e MvcEvent */
     $eventManager = $e->getApplication()->getEventManager();
     $services = $e->getApplication()->getServiceManager();
     $sharedManager = $eventManager->getSharedManager();
     $createJobListener = new \Organizations\Acl\Listener\CheckJobCreatePermissionListener();
     $createJobListener->attachShared($sharedManager);
 }
开发者ID:utrenkner,项目名称:YAWIK,代码行数:9,代码来源:Module.php

示例9: onBootstrap

 /**
  * @param EventInterface $event
  *
  * @return array|void
  */
 public function onBootstrap(EventInterface $event)
 {
     /** @var \Zend\Mvc\MvcEvent $event */
     /** @var Service\SessionGuard $service */
     $service = $event->getApplication()->getServiceManager()->get('DmMailerAdmin\\Service\\SessionGuard');
     /** @var \Zend\EventManager\EventManager $entityManager */
     $entityManager = $event->getApplication()->getEventManager();
     $entityManager->attachAggregate($service);
 }
开发者ID:peteraba,项目名称:dm-maileradmin,代码行数:14,代码来源:Module.php

示例10: onBootstrap

 /**
  * @param EventInterface $e
  *
  * @return array|void
  *
  * @throws \Zend\ServiceManager\Exception\ServiceNotFoundException
  */
 public function onBootstrap(EventInterface $e)
 {
     /** @var MvcEvent $e */
     $eventManager = $e->getApplication()->getEventManager();
     $moduleRouteListener = new ModuleRouteListener();
     $moduleRouteListener->attach($eventManager);
     /** @var WorkflowDispatchListener $injectWorkflowListener */
     $injectWorkflowListener = $e->getApplication()->getServiceManager()->get(WorkflowDispatchListener::class);
     $eventManager->attach($injectWorkflowListener);
 }
开发者ID:old-town,项目名称:workflow-zf2-engine,代码行数:17,代码来源:Module.php

示例11: onBootstrap

 public function onBootstrap(EventInterface $e)
 {
     $application = $e->getTarget();
     $eventManager = $application->getEventManager();
     $services = $application->getServiceManager();
     $services->get('Server');
     $e->getApplication()->getEventManager()->getSharedManager()->attach('Zend\\Mvc\\Controller\\AbstractController', 'dispatch', function ($e) {
         $controller = $e->getTarget();
         $controllerClass = get_class($controller);
         $moduleNamespace = substr($controllerClass, 0, strpos($controllerClass, '\\'));
         $config = $e->getApplication()->getServiceManager()->get('config');
         if (isset($config['module_layouts'][$moduleNamespace])) {
             $controller->layout($config['module_layouts'][$moduleNamespace]);
         }
     }, 100);
     $eventManager->attach('route', function ($event) {
         $sm = $event->getApplication()->getServiceManager();
         $config = $event->getApplication()->getServiceManager()->get('Config');
         $localesConfig = $config['locales'];
         $locales = $localesConfig['list'];
         $locale = $event->getRouteMatch()->getParam('locale', null);
         if (empty($locale)) {
             $locale = isset($_COOKIE['locale']) ? $_COOKIE['locale'] : $localesConfig['default']['code'];
         }
         if (in_array($locale, array_keys($locales))) {
             $locale = $locales[$locale]['code'];
         } else {
             $locale = $localesConfig['default']['code'];
         }
         $translator = $sm->get('translator');
         $translator->setLocale($locale);
         $httpServer = "";
         if (isset($_SERVER['HTTP_HOST'])) {
             $httpServer = $_SERVER['HTTP_HOST'];
         }
         setcookie('locale', $locale, time() + 3600, '/', $httpServer);
     }, -10);
     $moduleRouteListener = new ModuleRouteListener();
     $moduleRouteListener->attach($eventManager);
     $eventManager->attach('dispatch.error', function ($event) use($services) {
         $event->getResult()->setTerminal(TRUE);
         $exception = $event->getResult()->exception;
         $error = $event->getError();
         if (!$exception && !$error) {
             return;
         }
         $service = $services->get('Likerow\\ErrorHandler');
         if ($exception) {
             $service->logException($exception, $services->get('Mail'));
         }
         if ($error) {
             $service->logError('Dispatch ERROR: ' . $error, $services->get('Mail'));
         }
     });
 }
开发者ID:likerow,项目名称:edutek,代码行数:55,代码来源:Module.php

示例12: onBootstrap

 /**
  * Listen to the bootstrap event
  *
  * @param EventInterface $e
  *
  * @return void
  */
 public function onBootstrap(EventInterface $e)
 {
     /** @var MvcEvent $e */
     $eventManager = $e->getApplication()->getEventManager();
     $moduleRouteListener = new ModuleRouteListener();
     $moduleRouteListener->attach($eventManager);
     // add layout listener
     $eventManager->attachAggregate(new LayoutListener(array('header', 'footer')));
     // configure session
     $e->getApplication()->getServiceManager()->get('Session\\Config');
 }
开发者ID:samsonasik,项目名称:zf2rapid-skeleton,代码行数:18,代码来源:Module.php

示例13: onBootstrap

 /**
  * @param EventInterface $e
  *
  * @return array|void
  *
  * @throws \Zend\ServiceManager\Exception\ServiceNotFoundException
  */
 public function onBootstrap(EventInterface $e)
 {
     /** @var MvcEvent $e */
     $eventManager = $e->getApplication()->getEventManager();
     $moduleRouteListener = new ModuleRouteListener();
     $moduleRouteListener->attach($eventManager);
     /** @var Workflow $workflowService */
     $workflowService = $e->getApplication()->getServiceManager()->get(Workflow::class);
     $listener = $e->getApplication()->getServiceManager()->get(InjectTypeResolver::class);
     $workflowService->getEventManager()->attach($listener);
 }
开发者ID:old-town,项目名称:workflow-zf2-service,代码行数:18,代码来源:Module.php

示例14: onBootstrap

 /**
  * Listen to the bootstrap event
  *
  * @return array
  */
 public function onBootstrap(EventInterface $e)
 {
     // add route listener
     $e->getApplication()->getEventManager()->attachAggregate(new UserListener());
     // set service locator
     $this->serviceLocator = $e->getApplication()->getServiceManager();
     // get shared event manager
     $sharedEventManager = $this->serviceLocator->get('SharedEventManager');
     // add form event
     $sharedEventManager->attach('User\\Service\\UserService', 'set-user-form', array($this, 'onFormSet'));
 }
开发者ID:andreaszobl,项目名称:software,代码行数:16,代码来源:Module.php

示例15: onBootstrap

 /**
  * @param EventInterface $e
  *
  * @return array|void
  *
  * @throws \Zend\ServiceManager\Exception\ServiceNotFoundException
  */
 public function onBootstrap(EventInterface $e)
 {
     /** @var MvcEvent $e */
     $eventManager = $e->getApplication()->getEventManager();
     $moduleRouteListener = new ModuleRouteListener();
     $moduleRouteListener->attach($eventManager);
     $sm = $e->getApplication()->getServiceManager();
     /** @var EntryIdResolver $entryIdResolver */
     $entryIdResolver = $sm->get(EntryIdResolver::class);
     $eventManager->attach($entryIdResolver);
 }
开发者ID:old-town,项目名称:workflow-zf2-toolkit,代码行数:18,代码来源:Module.php


注:本文中的Zend\EventManager\EventInterface::getApplication方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。