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


PHP ModuleManagerInterface::getEventManager方法代码示例

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


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

示例1: init

 /**
  * @param  ModuleManagerInterface $moduleManager
  * @throws \Exception
  */
 public function init(ModuleManagerInterface $moduleManager)
 {
     if (PHP_SAPI === 'cli') {
         return;
     }
     $rootApplicationPath = realpath(dirname('.'));
     $userConfig = $this->getUserConfig();
     if (!isset($userConfig['maintenance']['flag_file'])) {
         throw new \Exception('The \'flag_file\' parameter is missing in config/autoload/config/autoload/maintenance{,*.}{global,local}.php');
     }
     if (file_exists($rootApplicationPath . DIRECTORY_SEPARATOR . $userConfig['maintenance']['flag_file'])) {
         if (!isset($userConfig['maintenance']['status_code']) || !isset($userConfig['maintenance']['message'])) {
             throw new \Exception('Please fill all the parameters in config/autoload/config/autoload/maintenance{,*.}{global,local}.php');
         }
         $moduleManager->getEventManager()->attach(ModuleEvent::EVENT_LOAD_MODULE, function (ModuleEvent $moduleEvent) {
             $moduleEvent->stopPropagation(true);
         }, PHP_INT_MAX);
         $moduleManager->getEventManager()->getSharedManager()->attach(Application::class, MvcEvent::EVENT_BOOTSTRAP, function (MvcEvent $mvcEvent) use($userConfig) {
             $response = $mvcEvent->getResponse();
             $response->setStatusCode($userConfig['maintenance']['status_code']);
             $response->setContent($this->getResponseContent());
             $mvcEvent->stopPropagation(true);
         }, PHP_INT_MAX);
     }
 }
开发者ID:mpalourdio,项目名称:zf2-maintenance-mode,代码行数:29,代码来源:Module.php

示例2: getModuleManager

 /**
  * @return ModuleManagerInterface
  */
 protected function getModuleManager()
 {
     if (null == $this->moduleManager) {
         $this->moduleManager = new ModuleManager([]);
         $this->moduleManager->getEventManager()->attach(ModuleEvent::EVENT_LOAD_MODULE_RESOLVE, new ModuleResolverListener());
     }
     return $this->moduleManager;
 }
开发者ID:mtymek,项目名称:modular-expressive,代码行数:11,代码来源:ModularApplicationFactory.php

示例3: init

 /**
  * Initialize workflow
  *
  * @param  ModuleManagerInterface $manager
  * @return void
  */
 public function init(ModuleManagerInterface $manager)
 {
     $eventManager = $manager->getEventManager();
     $eventManager->attach(ProfilerEvent::EVENT_PROFILER_INIT, function () {
         xhprof_enable(XHPROF_FLAGS_MEMORY);
     });
 }
开发者ID:skpd,项目名称:profiler-toolbar,代码行数:13,代码来源:Module.php

示例4: init

 public function init(ModuleManagerInterface $manager)
 {
     $events = $manager->getEventManager();
     // Registering a listener at default priority, 1, which will trigger
     // after the ConfigListener merges config.
     $events->attach(ModuleEvent::EVENT_MERGE_CONFIG, array($this, 'onMergeConfig'));
 }
开发者ID:JPG-Consulting,项目名称:LocaleManager-OLD,代码行数:7,代码来源:Module.php

示例5: init

 /**
  * @param ModuleManagerInterface $moduleManager
  */
 public function init(ModuleManagerInterface $moduleManager)
 {
     $moduleManager->loadModule('DoctrineModule');
     $moduleManager->loadModule('DoctrineORMModule');
     $moduleManager->loadModule('CmsDoctrine');
     $em = $moduleManager->getEventManager();
     $em->attach(ModuleEvent::EVENT_LOAD_MODULES_POST, [$this, 'onPostLoadModules']);
 }
开发者ID:coolms,项目名称:doctrine-orm,代码行数:11,代码来源:Module.php

示例6: init

 /**
  * Initialize workflow
  *
  * @param  ModuleManagerInterface $manager
  */
 public function init(ModuleManagerInterface $manager)
 {
     if (PHP_SAPI === 'cli') {
         return;
     }
     $eventManager = $manager->getEventManager();
     $eventManager->attach(ModuleEvent::EVENT_LOAD_MODULES_POST, array($this, 'onLoadModulesPost'), -1100);
 }
开发者ID:rafajaques,项目名称:colloquium,代码行数:13,代码来源:Module.php

示例7: init

 /**
  * Init
  *
  * @param \Zend\ModuleManager\ModuleManagerInterface
  * @return void
  */
 public function init(ModuleManagerInterface $moduleManager)
 {
     // get the service manager
     $this->serviceLocator = $moduleManager->getEvent()->getParam('ServiceManager');
     // get the module manager
     $this->moduleManager = $moduleManager;
     $moduleManager->getEventManager()->attach(ModuleEvent::EVENT_LOAD_MODULES_POST, [$this, 'initApplication']);
 }
开发者ID:esase,项目名称:dream-cms,代码行数:14,代码来源:Module.php

示例8: init

 /**
  * Initialize workflow
  *
  * @param  ModuleManagerInterface $manager
  * @return void
  */
 public function init(ModuleManagerInterface $manager)
 {
     $this->moduleManager = $manager;
     $this->serviceLocator = $manager->getEvent()->getParam('ServiceManager');
     $shared = $manager->getEventManager()->getSharedManager();
     $shared->attach('Zend\\Stdlib\\DispatchableInterface', MvcEvent::EVENT_DISPATCH, array(new InjectTemplateListener(), 'injectTemplate'), -85);
     $shared->attach('Zend\\Stdlib\\DispatchableInterface', MvcEvent::EVENT_DISPATCH, array($this, 'onDispatch'), 100);
 }
开发者ID:gridguyz,项目名称:core,代码行数:14,代码来源:Module.php

示例9: init

 /**
  * {@inheritDoc}
  */
 public function init(ModuleManagerInterface $manager)
 {
     $events = $manager->getEventManager();
     // Initialize logger collector once the profiler is initialized itself
     $events->attach('profiler_init', function (EventInterface $e) use($manager) {
         $manager->getEvent()->getParam('ServiceManager')->get('doctrine.couch_logger_collector.odm_default');
     });
 }
开发者ID:Ellipizle,项目名称:DoctrineCouchODMModule,代码行数:11,代码来源:Module.php

示例10: init

 /**
  * {@inheritDoc}
  */
 public function init(ModuleManagerInterface $manager)
 {
     $events = $manager->getEventManager();
     // Initialize logger collector once the profiler is initialized itself
     $events->attach('profiler_init', function () use($manager) {
         $manager->getEvent()->getParam('ServiceManager')->get('doctrine.sql_logger_collector.orm_default');
     });
     $events->getSharedManager()->attach('doctrine', 'loadCli.post', array($this, 'initializeConsole'));
 }
开发者ID:oscar121,项目名称:doggerout,代码行数:12,代码来源:Module.php

示例11: init

 public function init(ModuleManagerInterface $manager)
 {
     $events = $manager->getEventManager();
     // Initialize logger collector once the profiler is initialized itself
     $events->attach('profiler_init', function () use($manager) {
         $manager->getEvent()->getParam('ServiceManager')->get('doctrine.sql_logger_collector.orm_another');
         // moduificare nome
     });
 }
开发者ID:89snake89,项目名称:PHPTest,代码行数:9,代码来源:Module.php

示例12: init

 public function init(\Zend\ModuleManager\ModuleManagerInterface $moduleManager)
 {
     if (\Zend\Console\Console::isConsole()) {
         return;
     }
     $eventManager = $moduleManager->getEventManager()->getSharedManager();
     $tokenListener = new TokenListener();
     $tokenListener->attachShared($eventManager);
 }
开发者ID:webpants,项目名称:YAWIK,代码行数:9,代码来源:Module.php

示例13: init

 /**
  * Initialize workflow
  *
  * @param  ModuleManagerInterface $manager
  */
 public function init(ModuleManagerInterface $manager)
 {
     defined('REQUEST_MICROTIME') || define('REQUEST_MICROTIME', microtime(true));
     if (PHP_SAPI === 'cli') {
         return;
     }
     $eventManager = $manager->getEventManager();
     $eventManager->attach(ModuleEvent::EVENT_LOAD_MODULES_POST, array($this, 'onLoadModulesPost'), -1100);
 }
开发者ID:gstearmit,项目名称:EshopVegeTable,代码行数:14,代码来源:Module.php

示例14: init

 public function init(ModuleManagerInterface $moduleManager)
 {
     $events = $moduleManager->getEventManager();
     //$events->attach(ModuleEvent::EVENT_MERGE_CONFIG, array($this, 'onMergeConfig'));
     //$events->attach(ModuleEvent::EVENT_LOAD_MODULE, new ThemeListener());
     $events->attachAggregate(new ThemeListener());
     $sharedEvents = $events->getSharedManager();
     // VIEW MANAGER IS TRIGGERED AT 10000
     $sharedEvents->attach('Zend\\Mvc\\Application', MvcEvent::EVENT_BOOTSTRAP, array($this, 'onPostBootstrap'), 9999);
     //$sharedEvents->attachAggregate(new ThemeManager());
 }
开发者ID:shadowfax,项目名称:zf2-theme-manager,代码行数:11,代码来源:Module.php

示例15: init

 /**
  * Init
  */
 public function init(ModuleManagerInterface $moduleManager)
 {
     // get service manager
     $this->serviceLocator = $moduleManager->getEvent()->getParam('ServiceManager');
     $moduleManager->getEventManager()->attach(ModuleEvent::EVENT_LOAD_MODULES_POST, [$this, 'initApplication']);
     $eventManager = AclEvent::getEventManager();
     $eventManager->attach(AclEvent::DELETE_ROLE, function ($e) use($moduleManager) {
         $userModel = $moduleManager->getEvent()->getParam('ServiceManager')->get('Application\\Model\\ModelManager')->getInstance('User\\Model\\UserBase');
         // change the empty role with the default role
         $userModel->updateUsersWithEmptyRoles(AclBaseModel::DEFAULT_ROLE_MEMBER);
     }, -100);
 }
开发者ID:spooner77,项目名称:dream-cms,代码行数:15,代码来源:Module.php


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