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


PHP SharedEventManagerInterface::attach方法代码示例

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


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

示例1: attachShared

 public function attachShared(SharedEventManagerInterface $events)
 {
     $class = $this->getMonitoredClass();
     $events->attach($class, 'commit', [$this, 'onAddRevision'], 1);
     $events->attach($class, 'checkout', [$this, 'onCheckout'], -1);
     $events->attach($class, 'reject', [$this, 'onReject'], -1);
 }
开发者ID:andreas-serlo,项目名称:athene2,代码行数:7,代码来源:RepositoryManagerListener.php

示例2: attachShared

 public function attachShared(SharedEventManagerInterface $events)
 {
     $monitoredClass = $this->getMonitoredClass();
     $events->attach($monitoredClass, 'create', [$this, 'onCreate']);
     $events->attach($monitoredClass, 'update', [$this, 'onUpdate']);
     $events->attach($monitoredClass, 'associate', [$this, 'onAssociate']);
     $events->attach($monitoredClass, 'dissociate', [$this, 'onDissociate']);
 }
开发者ID:andreas-serlo,项目名称:athene2,代码行数:8,代码来源:TaxonomyManagerListener.php

示例3: attachShared

 public function attachShared(SharedEventManagerInterface $events)
 {
     $class = $this->getMonitoredClass();
     $events->attach($class, 'start', [$this, 'onStart']);
     $events->attach($class, 'comment', [$this, 'onComment']);
     $events->attach($class, 'archive', [$this, 'onArchive']);
     $events->attach($class, 'restore', [$this, 'onRestore']);
 }
开发者ID:andreas-serlo,项目名称:athene2,代码行数:8,代码来源:DiscussionManagerListener.php

示例4: attachShared

 public function attachShared(\Zend\EventManager\SharedEventManagerInterface $events)
 {
     $class = $this->getMonitoredClass();
     $events->attach($class, 'parent.change', [$this, 'onParentChange']);
     $events->attach($class, 'create', [$this, 'onCreate']);
     $events->attach($class, 'update', [$this, 'onUpdate']);
     $events->attach($class, 'associate', [$this, 'onAssociate']);
     $events->attach($class, 'dissociate', [$this, 'onDissociate']);
 }
开发者ID:andreas-serlo,项目名称:athene2,代码行数:9,代码来源:TaxonomyManagerListener.php

示例5: attachShared

 public function attachShared(SharedEventManagerInterface $events, $priority = null)
 {
     $this->priority = $priority;
     $listeners = array();
     $listeners[] = $events->attach($this->identity, 'foo.bar', array($this, 'fooBar'));
     $listeners[] = $events->attach($this->identity, 'foo.baz', array($this, 'fooBaz'));
     $this->listeners[\spl_object_hash($events)] = $listeners;
     return __METHOD__;
 }
开发者ID:rajanlamic,项目名称:IntTest,代码行数:9,代码来源:SharedMockAggregate.php

示例6: attachShared

 public function attachShared(SharedEventManagerInterface $events)
 {
     $events->attach('*', NotificationEvent::EVENT_NOTIFICATION_ADD, array($this, 'add'), 1);
     $events->attach('Zend\\Mvc\\Application', MvcEvent::EVENT_DISPATCH, array($this, 'renderJSON'), -240);
     $events->attach('Zend\\Mvc\\Application', MvcEvent::EVENT_DISPATCH, array($this, 'renderHTML'), -250);
     // Sometimes the Dispatch-Event is not reached, for instance with a route-direct
     // but also for Events, that are happening after the Dispatch
     $events->attach('Zend\\Mvc\\Application', MvcEvent::EVENT_FINISH, array($this, 'renderHTML'), -250);
     return $this;
 }
开发者ID:webpants,项目名称:YAWIK,代码行数:10,代码来源:NotificationListener.php

示例7: attachSharedListeners

 /**
  * Attach shared listeners to the RestServiceModel.
  *
  * @param SharedEventManagerInterface $sharedEvents
  * @param ContainerInterface $container
  * @return void
  */
 private function attachSharedListeners(SharedEventManagerInterface $sharedEvents, ContainerInterface $container)
 {
     $sharedEvents->attach(RestServiceModel::class, 'fetch', [DbConnectedRestServiceModel::class, 'onFetch']);
     $modules = $container->get('ModuleManager');
     $loaded = $modules->getLoadedModules(false);
     if (!isset($loaded['ZF\\Apigility\\Doctrine\\Admin'])) {
         return;
     }
     // Wire Doctrine-Connected fetch listener
     $sharedEvents->attach(RestServiceModel::class, 'fetch', [DoctrineRestServiceModel::class, 'onFetch']);
 }
开发者ID:zfcampus,项目名称:zf-apigility-admin,代码行数:18,代码来源:RestServiceModelFactoryFactory.php

示例8: attachShared

 public function attachShared(SharedEventManagerInterface $events)
 {
     $class = 'Athene2\\Versioning\\Manager\\RepositoryManager';
     // Looks like everything worked out fine!
     $events->attach($class, VersioningEvent::COMMIT, [$this, 'onCommit']);
     $events->attach($class, VersioningEvent::CHECKOUT, [$this, 'onCheckout']);
     $events->attach($class, VersioningEvent::REJECT, [$this, 'onReject']);
     // These events get triggered, when authorization was not granted.
     // $events->attach($class, VersioningEvent::COMMIT_UNAUTHORIZED, [$this, 'onCommitError']);
     // $events->attach($class, VersioningEvent::CHECKOUT_UNAUTHORIZED, [$this, 'onCheckoutError']);
     // $events->attach($class, VersioningEvent::REJECT_UNAUTHORIZED, [$this, 'onRejectError']);
 }
开发者ID:serlo-org,项目名称:athene2-versioning,代码行数:12,代码来源:SharedListenerExample.php

示例9: attachShared

 /**
  * @param SharedEventManagerInterface $events
  */
 public function attachShared(SharedEventManagerInterface $events)
 {
     $listener = $events->attach(RestController::class, MvcEvent::EVENT_DISPATCH, [$this, 'onDispatch'], 100);
     if (!$listener) {
         $listener = [$this, 'onDispatch'];
     }
     $this->sharedListeners[] = $listener;
 }
开发者ID:Wilt,项目名称:zf-rest,代码行数:11,代码来源:RestParametersListener.php

示例10: attachShared

 /**
  * Attach listeners to an event manager
  *
  * @param  EventManagerInterface $events
  * @return void
  *
  * @SuppressWarnings(PHPMD.UnusedLocalVariable)
  */
 public function attachShared(SharedEventManagerInterface $events)
 {
     $this->listeners[] = $events->attach('*', ImageEvent::POST_SUCCESS, [$this, 'postSuccess'], 1);
     $this->listeners[] = $events->attach('*', ImageEvent::POST_UPLOAD, [$this, 'backupImage'], 1000);
     $this->listeners[] = $events->attach('*', ImageEvent::POST_UPLOAD, [$this, 'resizeImage'], 500);
     $this->listeners[] = $events->attach('*', ImageEvent::POST_UPLOAD, [$this, 'thumbnailImage'], 100);
     $this->listeners[] = $events->attach('*', ImageEvent::PUT_SUCCESS, [$this, 'putSuccess'], 1);
     $this->listeners[] = $events->attach('*', ImageEvent::DEL_SUCCESS, [$this, 'delSuccess'], 1);
     $this->listeners[] = $events->attach('*', ImageEvent::DEL_FAILED, [$this, 'delFailed'], 1);
 }
开发者ID:aqilix,项目名称:apigility-image,代码行数:18,代码来源:SharedEventListener.php

示例11: attachListeners

 public function attachListeners(SharedEventManagerInterface $sharedEventManager)
 {
     $sharedEventManager->attach('Omeka\\Form\\SiteSettingsForm', Event::SITE_SETTINGS_ADD_ELEMENTS, [$this, 'addSiteEnableCheckbox']);
     $sharedEventManager->attach('Omeka\\Form\\SiteSettingsForm', Event::SITE_SETTINGS_ADD_INPUT_FILTERS, [$this, 'addSiteSettingsFilters']);
     $sharedEventManager->attach('Omeka\\Controller\\Site\\Item', 'view.show.before', array($this, 'viewShowAfter'));
     $sharedEventManager->attach('Omeka\\Controller\\Site\\Page', 'view.show.after', array($this, 'viewShowAfter'));
     $sharedEventManager->attach('Omeka\\Controller\\Site\\Item', 'view.show.after', array($this, 'insertOpenGraphData'));
     $sharedEventManager->attach('Omeka\\Controller\\Site\\Index', 'view.show.after', array($this, 'insertOpenGraphData'));
     $sharedEventManager->attach('Omeka\\Controller\\Site\\Page', 'view.show.after', array($this, 'insertOpenGraphData'));
 }
开发者ID:omeka-s-modules,项目名称:Sharing,代码行数:10,代码来源:Module.php

示例12: attachShared

 /**
  * @param SharedEventManagerInterface $events
  */
 public function attachShared(SharedEventManagerInterface $events)
 {
     $classes = $this->cacheOptions->getListens();
     foreach ($classes as $class => $options) {
         foreach ($options as $event => $invalidators) {
             $strategyManager = $this->strategyManager;
             $events->attach($class, $event, function (Event $e) use($class, $event, $invalidators, $strategyManager) {
                 foreach ($invalidators as $invalidator) {
                     $invalidator = $strategyManager->get($invalidator);
                     $invalidator->invalidate($e, $class, $event);
                 }
             });
         }
     }
 }
开发者ID:andreas-serlo,项目名称:athene2,代码行数:18,代码来源:CacheListener.php

示例13: attachListeners

 /**
  * {@inheritDoc}
  */
 public function attachListeners(SharedEventManagerInterface $sharedEventManager)
 {
     $sharedEventManager->attach('Zend\\View\\Helper\\Navigation\\AbstractHelper', 'isAllowed', [$this, 'navigationPageIsAllowed']);
     $sharedEventManager->attach('Omeka\\Entity\\Media', OmekaEvent::ENTITY_REMOVE_POST, [$this, 'deleteMediaFiles']);
     $sharedEventManager->attach('Omeka\\Api\\Representation\\MediaRepresentation', OmekaEvent::REP_RESOURCE_JSON, [$this, 'filterHtmlMediaJsonLd']);
     $sharedEventManager->attach('Omeka\\Api\\Representation\\MediaRepresentation', OmekaEvent::REP_RESOURCE_JSON, [$this, 'filterYoutubeMediaJsonLd']);
     $sharedEventManager->attach('Omeka\\Api\\Adapter\\MediaAdapter', [OmekaEvent::API_SEARCH_QUERY, OmekaEvent::API_FIND_QUERY], [$this, 'filterMedia']);
     $sharedEventManager->attach('Omeka\\Api\\Adapter\\SiteAdapter', [OmekaEvent::API_SEARCH_QUERY, OmekaEvent::API_FIND_QUERY], [$this, 'filterSites']);
     $sharedEventManager->attach(['Omeka\\Controller\\Admin\\Item', 'Omeka\\Controller\\Admin\\ItemSet', 'Omeka\\Controller\\Admin\\Media', 'Omeka\\Controller\\Site\\Item', 'Omeka\\Controller\\Site\\Media'], 'view.show.after', function (OmekaEvent $event) {
         $resource = $event->getTarget()->resource;
         echo $resource->embeddedJsonLd();
     });
     $sharedEventManager->attach(['Omeka\\Controller\\Admin\\Item', 'Omeka\\Controller\\Admin\\ItemSet', 'Omeka\\Controller\\Admin\\Media', 'Omeka\\Controller\\Site\\Item'], 'view.browse.after', function (OmekaEvent $event) {
         $resources = $event->getTarget()->resources;
         foreach ($resources as $resource) {
             echo $resource->embeddedJsonLd();
         }
     });
 }
开发者ID:patrova,项目名称:omeka-s,代码行数:22,代码来源:Module.php

示例14: attach

 /**
  * Attach listener to shared event manager.
  *
  * @param SharedEventManagerInterface $manager Shared event manager
  *
  * @return void
  */
 public function attach(SharedEventManagerInterface $manager)
 {
     $manager->attach('VuFind\\Search', Service::EVENT_PRE, [$this, 'onSearchPre']);
     $manager->attach('VuFind\\Search', Service::EVENT_POST, [$this, 'onSearchPost']);
 }
开发者ID:paulusova,项目名称:VuFind-2.x,代码行数:12,代码来源:InjectSpellingListener.php

示例15: attachListeners

 public function attachListeners(SharedEventManagerInterface $sharedEventManager)
 {
     $sharedEventManager->attach('Omeka\\DataType\\Manager', 'service.registered_names', [$this, 'addVocabularyServices']);
     $sharedEventManager->attach('CustomVocab\\Entity\\CustomVocab', 'entity.remove.pre', [$this, 'setVocabTypeToDefaultState']);
 }
开发者ID:omeka-s-modules,项目名称:CustomVocab,代码行数:5,代码来源:Module.php


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