當前位置: 首頁>>代碼示例>>PHP>>正文


PHP EventManagerInterface::attachAggregate方法代碼示例

本文整理匯總了PHP中Zend\EventManager\EventManagerInterface::attachAggregate方法的典型用法代碼示例。如果您正苦於以下問題:PHP EventManagerInterface::attachAggregate方法的具體用法?PHP EventManagerInterface::attachAggregate怎麽用?PHP EventManagerInterface::attachAggregate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend\EventManager\EventManagerInterface的用法示例。


在下文中一共展示了EventManagerInterface::attachAggregate方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: attachWorkerListeners

 /**
  * @param EventManagerInterface $eventManager
  * @param StrategyPluginManager $listenerPluginManager
  * @param array $strategyConfig
  * @throws RuntimeException
  */
 protected function attachWorkerListeners(EventManagerInterface $eventManager, StrategyPluginManager $listenerPluginManager, array $strategyConfig = [])
 {
     foreach ($strategyConfig as $strategy => $options) {
         // no options given, name stored as value
         if (is_numeric($strategy) && is_string($options)) {
             $strategy = $options;
             $options = [];
         }
         if (!is_string($strategy) || !is_array($options)) {
             continue;
         }
         $priority = null;
         if (isset($options['priority'])) {
             $priority = $options['priority'];
             unset($options['priority']);
         }
         $listener = $listenerPluginManager->get($strategy, $options);
         if (!is_null($priority)) {
             $eventManager->attachAggregate($listener, $priority);
         } else {
             $eventManager->attachAggregate($listener);
         }
     }
     if (!in_array(WorkerEvent::EVENT_BOOTSTRAP, $eventManager->getEvents())) {
         throw new RuntimeException(sprintf("No worker strategy has been registered to respond to the '%s' event.", WorkerEvent::EVENT_BOOTSTRAP));
     }
 }
開發者ID:jackdpeterson,項目名稱:SlmQueue,代碼行數:33,代碼來源:WorkerFactory.php

示例2: attach

 /**
  * Attach one or more listeners
  *
  * @param EventManagerInterface $events
  * @return DefaultListenerAggregate
  */
 public function attach(EventManagerInterface $events)
 {
     $options = $this->getOptions();
     $configListener = $this->getConfigListener();
     $locatorRegistrationListener = new LocatorRegistrationListener($options);
     $moduleAutoloader = new ModuleAutoloader($options->getModulePaths());
     $this->listeners[] = $events->attach('loadModules.pre', array($moduleAutoloader, 'register'), 1000);
     $this->listeners[] = $events->attach('loadModule.resolve', new ModuleResolverListener(), 1000);
     $this->listeners[] = $events->attach('loadModule', new AutoloaderListener($options), 2000);
     $this->listeners[] = $events->attach('loadModule', new InitTrigger($options), 1000);
     $this->listeners[] = $events->attach('loadModule', new OnBootstrapListener($options), 1000);
     $this->listeners[] = $events->attachAggregate($locatorRegistrationListener);
     $this->listeners[] = $events->attachAggregate($configListener);
     return $this;
 }
開發者ID:rikaix,項目名稱:zf2,代碼行數:21,代碼來源:DefaultListenerAggregate.php

示例3: init

 /**
  * Registers listeners if enabled.
  *
  * @return self
  */
 public function init()
 {
     if ($this->options->isEnabled()) {
         if ($this->options->canFlushEarly()) {
             $this->eventManager->attachAggregate($this->serviceLocator->get('ZDT_FlushListener'));
         }
         if ($this->options->isStrict() && $this->report->hasErrors()) {
             throw new Exception\InvalidOptionException(implode(' ', $this->report->getErrors()));
         }
         $this->eventManager->attachAggregate($this->serviceLocator->get('ZDT_ProfileListener'));
         $this->registerVerbose()->registerToolbar();
         if ($this->options->isStrict() && $this->report->hasErrors()) {
             throw new Exception\ProfilerException(implode(' ', $this->report->getErrors()));
         }
     }
     return $this;
 }
開發者ID:raZ3l,項目名稱:ZendDeveloperTools,代碼行數:22,代碼來源:Bootstrap.php

示例4: attach

 public function attach(ListenerAggregateInterface $listener)
 {
     $this->events->attachAggregate($listener);
 }
開發者ID:nickvkaam,項目名稱:SpraySerializer,代碼行數:4,代碼來源:Serializer.php

示例5: loadEvent

 protected function loadEvent(EventManagerInterface $eventManager)
 {
     $eventManager->attachAggregate(new AuthorizationListenerAggregate());
 }
開發者ID:strapieno,項目名稱:skeleton,代碼行數:4,代碼來源:Module.php

示例6: injectDefaultListeners

 /**
  * @param EventManagerInterface $eventManager
  */
 protected function injectDefaultListeners(EventManagerInterface $eventManager)
 {
     $eventManager->attachAggregate(new Plugin\Message());
     $eventManager->attachAggregate(new Feature\Executor());
     $eventManager->attachAggregate(new Feature\Notifications());
 }
開發者ID:sporkcode,項目名稱:sporktools,代碼行數:9,代碼來源:Manager.php


注:本文中的Zend\EventManager\EventManagerInterface::attachAggregate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。