/** * @see \Zend\EventManager\ListenerAggregateInterface::attach() */ public function attach(EventManagerInterface $events) { $this->listeners[] = $events->attach('preFind', [$this, 'preFind']); $this->listeners[] = $events->attach('postFind', [$this, 'postFind']); $this->listeners[] = $events->attach('onSave', [$this, 'onSave']); $this->listeners[] = $events->attach('onDelete', [$this, 'onDelete']); }
/** * Attach listeners to an event manager * * @param EventManagerInterface $events * @return void */ public function attach(EventManagerInterface $events) { $this->listeners[] = $events->attach(MvcEvent::EVENT_DISPATCH, array($this, 'onDispatch')); if (function_exists('zend_monitor_custom_event_ex')) { $this->listeners[] = $events->attach(MvcEvent::EVENT_DISPATCH_ERROR, array($this, 'reportMonitorEvent')); } }
/** * Attach one or more listeners * * Implementors may add an optional $priority argument; the EventManager * implementation will pass this to the aggregate. * * @param EventManagerInterface $events * * @return void */ public function attach(EventManagerInterface $events) { $this->listeners[] = $events->attach('action.send.pre', [$this, 'onSendingAction']); $this->listeners[] = $events->attach('node.send.pre', [$this, 'onSendingNode']); $this->listeners[] = $events->attach('node.send.post', [$this, 'onNodeSent']); $this->listeners[] = $events->attach('node.received', [$this, 'onNodeReceived']); }
public function attach(EventManagerInterface $events) { $this->listeners[] = $events->attach(MvcEvent::EVENT_DISPATCH, array($this, 'onPreDispatch'), 9999); $this->listeners[] = $events->attach(MvcEvent::EVENT_DISPATCH_ERROR, array($this, 'onPreDispatch'), 9999); $this->listeners[] = $events->attach(MvcEvent::EVENT_FINISH, array($this, 'onFinish')); $this->listeners[] = $events->attach(MvcEvent::EVENT_ROUTE, array($this, 'onPreRoute'), 9999); }
/** * @param EventManager\EventManagerInterface $events */ public function attach(EventManager\EventManagerInterface $events) { $this->listeners[] = $events->attach(DoctrineResourceEvent::EVENT_DELETE_PRE, array($this, 'delete')); $this->listeners[] = $events->attach(DoctrineResourceEvent::EVENT_FETCH_POST, array($this, 'fetch')); $this->listeners[] = $events->attach(DoctrineResourceEvent::EVENT_FETCH_ALL_PRE, array($this, 'fetchAll')); $this->listeners[] = $events->attach(DoctrineResourceEvent::EVENT_PATCH_PRE, array($this, 'patch')); }
public function attach(EventManagerInterface $events) { $this->listeners[] = $events->attach(MvcEvent::EVENT_BOOTSTRAP, [$this, 'onBootstrap']); $this->listeners[] = $events->attach(MvcEvent::EVENT_ROUTE, [$this, 'onRoute']); $this->listeners[] = $events->attach(MvcEvent::EVENT_DISPATCH, [$this, 'onDispatch']); $this->listeners[] = $events->attach(MvcEvent::EVENT_DISPATCH_ERROR, [$this, 'onDispatchError']); }
public function attach(EventManagerInterface $events) { $this->listeners[] = $events->attach(Event::RUN_JOB, array($this, 'jobHeader'), 1000); $this->listeners[] = $events->attach(Event::RUN_JOB, array($this, 'jobFooter'), -1000); $this->listeners[] = $events->attach(Event::RUN_TASK, array($this, 'taskHeader'), 1000); $this->listeners[] = $events->attach(Event::RUN_TASK, array($this, 'taskFooter'), -1000); }
public function attach(EventManagerInterface $events, $priority = 1) { if (PHP_SAPI !== 'cli') { $this->listeners[] = $events->attach(MvcEvent::EVENT_ROUTE, [$this, 'onRoute']); $this->listeners[] = $events->attach(MvcEvent::EVENT_ROUTE, [$this, 'onRender']); } }
/** * Attach listeners * * @param EventManagerInterface $events */ public function attach(EventManagerInterface $events) { $this->listeners[] = $events->attach(MvcEvent::EVENT_ROUTE, array($this, 'authentication'), -50); $this->listeners[] = $events->attach(MvcEvent::EVENT_ROUTE, array($this, 'authenticationPost'), -51); $this->listeners[] = $events->attach(MvcEvent::EVENT_ROUTE, array($this, 'authorization'), -600); $this->listeners[] = $events->attach(MvcEvent::EVENT_ROUTE, array($this, 'authorizationPost'), -601); }
/** * {@inheritDoc} */ public function attach(EventManagerInterface $eventManager, $priority = 1) { $sharedManager = $eventManager->getSharedManager(); $sharedManager->attach(DispatchableInterface::class, MvcEvent::EVENT_DISPATCH, [$this, 'setTemplate'], -100); $this->listeners[] = $eventManager->attach(ViewEvent::EVENT_RENDERER, [$this, 'selectRenderer'], $priority); $this->listeners[] = $eventManager->attach(ViewEvent::EVENT_RESPONSE, [$this, 'injectResponse'], $priority); }
public function attach(EventManagerInterface $events) { $this->listeners[] = $events->attach('bootstrap', array($this, 'onBootstrap'), 10000); $this->listeners[] = $events->attach(MvcEvent::EVENT_DISPATCH, array($this, 'beforeDispatch'), 100); $this->listeners[] = $events->attach(MvcEvent::EVENT_DISPATCH, array($this, 'onDispatch'), 0); //$this->listeners[] = $events->attach(MvcEvent::EVENT_RENDER, array($this, 'onRender'), 0); }
/** * @param EventManagerInterface $events */ public function attach(EventManagerInterface $events) { $this->listeners[] = $events->attach(MvcEvent::EVENT_BOOTSTRAP, array($this, 'handleNativeErrors'), -1); $this->listeners[] = $events->attach(MvcEvent::EVENT_BOOTSTRAP, array($this, 'handleFatalErrors'), -2); $this->listeners[] = $events->attach(MvcEvent::EVENT_DISPATCH_ERROR, array($this, 'handleExceptions'), -1); $this->listeners[] = $events->attach(MvcEvent::EVENT_RENDER_ERROR, array($this, 'handleExceptions'), -1); }
public function attach(EventManagerInterface $events) { // Set priority greater than 1 // so layout can be disabled in controller action if I want $this->listeners[] = $events->attach(MvcEvent::EVENT_DISPATCH, [$this, 'updateLayout'], 100); $this->listeners[] = $events->attach(MvcEvent::EVENT_DISPATCH_ERROR, [$this, 'keepLayout']); }
public function attach(EventManagerInterface $events) { $this->listeners[] = $events->attach('postOrder', array($this, 'sendConfirmation'), 300); $this->listeners[] = $events->attach('postOrder', array($this, 'updateStock'), 100); $this->listeners[] = $events->attach('postOrder', array($this, 'bakePizza'), 200); $this->listeners[] = $events->attach('preOrder', array($this, 'checkStock'), 100); }
/** * {@inheritdoc} */ public function attach(EventManagerInterface $events, $priority = 1) { $callback = array($this, 'hashKey'); $this->listeners[] = $events->attach('hasItem.pre', $callback, $priority); $this->listeners[] = $events->attach('getItem.pre', $callback, $priority); $this->listeners[] = $events->attach('setItem.pre', $callback, $priority); }
/** * Attach one or more listeners * * Implementors may add an optional $priority argument; the EventManager * implementation will pass this to the aggregate. * * @param EventManagerInterface $events * * @return void */ public function attach(EventManagerInterface $events) { $this->listeners[] = $events->attach(MvcEvent::EVENT_RENDER, array($this, 'onRender'), 1000); $this->listeners[] = $events->attach(MvcEvent::EVENT_DISPATCH_ERROR, array($this, 'onDispatchError'), 100); $sharedEvents = $events->getSharedManager(); $sharedEvents->attach('Zend\\Stdlib\\DispatchableInterface', MvcEvent::EVENT_DISPATCH, array($this, 'onDispatch'), 100); }
/** * {@inheritDoc} */ public function attach(EventManagerInterface $events) { $this->callbacks[] = $events->attach(ModuleEvent::EVENT_LOAD_MODULES, [$this->moduleLoader, 'register'], 9000); if ($this->generateCache) { $this->callbacks[] = $events->attach(ModuleEvent::EVENT_LOAD_MODULES_POST, [$this, 'onLoadModulesPost']); } }
/** * Attach one or more listeners * * Implementors may add an optional $priority argument; the EventManager * implementation will pass this to the aggregate. * * @param EventManagerInterface $events * * @return void */ public function attach(EventManagerInterface $events) { $this->listeners[] = $events->attach(MvcEvent::EVENT_DISPATCH, array($this, 'authentication'), 500); $this->listeners[] = $events->attach(MvcEvent::EVENT_DISPATCH, array($this, 'authenticationPost'), 499); $this->listeners[] = $events->attach(MvcEvent::EVENT_DISPATCH, array($this, 'authorization'), 498); $this->listeners[] = $events->attach(MvcEvent::EVENT_DISPATCH, array($this, 'authorizationPost'), 497); }
/** * Attach listeners * * @param EventManagerInterface $events */ public function attach(EventManagerInterface $events, $priority = 1) { $this->listeners[] = $events->attach(MvcEvent::EVENT_ROUTE, [$this, 'authentication'], -50); $this->listeners[] = $events->attach(MvcEvent::EVENT_ROUTE, [$this, 'authenticationPost'], -51); $this->listeners[] = $events->attach(MvcEvent::EVENT_ROUTE, [$this, 'authorization'], -600); $this->listeners[] = $events->attach(MvcEvent::EVENT_ROUTE, [$this, 'authorizationPost'], -601); }
/** * @param EventManagerInterface $events */ public function attach(EventManagerInterface $events) { $this->listeners[] = $events->attach('configureColumn', [$this, 'handleHeaderAnnotation']); $this->listeners[] = $events->attach('configureColumn', [$this, 'handleSearchAnnotation']); $this->listeners[] = $events->attach('configureColumn', [$this, 'handleSuggestAnnotation']); $this->listeners[] = $events->attach('discoverTitle', [$this, 'handleTitleAnnotation']); }
/** * {@inheritDoc} */ public function attach(EventManagerInterface $events) { // Preflight can be handled during the route event, and should return early $this->listeners[] = $events->attach(MvcEvent::EVENT_ROUTE, array($this, 'onCorsPreflight'), -1); // "in"flight should be handled during "FINISH" to ensure we operate on the actual route being returned $this->listeners[] = $events->attach(MvcEvent::EVENT_FINISH, array($this, 'onCorsRequest'), 100); }
/** * Attach one or more listeners * * @param EventManagerInterface $events * @return ConfigListener */ public function attach(EventManagerInterface $events) { $this->listeners[] = $events->attach('loadModule', array($this, 'loadModule'), 1000); $this->listeners[] = $events->attach('loadModules.pre', array($this, 'loadModulesPre'), 9000); $this->listeners[] = $events->attach('loadModules.post', array($this, 'loadModulesPost'), 9000); return $this; }
/** * Set the event manager instance used by this context * * @param EventManagerInterface $events * @return \User\Authentication\Service */ public function setEventManager(EventManagerInterface $events) { $events->setEventClass(__NAMESPACE__ . '\\Event'); $events->attach(Event::EVENT_LOGIN, array($this, 'onLogin'), 1000); $events->attach(Event::EVENT_LOGOUT, array($this, 'onLogout'), 0); return parent::setEventManager($events); }
/** * Attach events to the identity provider. * * This method attaches listeners to the authenticate.pre and authenticate * events of Detail\Auth\Identity\IdentityProvider. * * @param EventManagerInterface $events */ public function attach(EventManagerInterface $events) { $this->listeners[] = $events->attach(Event\IdentityProviderEvent::EVENT_PRE_AUTHENTICATE, array($this, 'onPreAuthenticate')); $this->listeners[] = $events->attach(Event\IdentityProviderEvent::EVENT_AUTHENTICATE, array($this, 'onAuthenticate')); $this->listeners[] = $events->attach(Event\IdentityAdapterEvent::EVENT_PRE_AUTHENTICATE, array($this, 'onAdapterPreAuthenticate')); $this->listeners[] = $events->attach(Event\IdentityAdapterEvent::EVENT_AUTHENTICATE, array($this, 'onAdapterAuthenticate')); }
public function attach(EventManagerInterface $events) { $events->attach(Collection::EVENT_AFTER_UPDATE, [$this, 'afterUpdate']); $events->attach(Collection::EVENT_AFTER_CREATE, [$this, 'afterCreate']); $events->attach(Collection::EVENT_BEFORE_CREATE, [$this, 'beforeCreate']); $events->attach(Collection::EVENT_AFTER_DELETE, [$this, 'afterDelete']); }
/** * Attach one or more listeners. * * Implementors may add an optional $priority argument; the EventManager * implementation will pass this to the aggregate. * * @param EventManagerInterface $events * @param int $priority */ public function attach(EventManagerInterface $events, $priority = 1) { $this->listeners[] = $events->attach('connect.pre', [$this, 'onConnect'], $priority); $this->listeners[] = $events->attach('disconnect.pre', [$this, 'onDisconnect'], $priority); $this->listeners[] = $events->attach('process.pre', [$this, 'onProcess'], $priority); $this->listeners[] = $events->attach('sendAction.pre', [$this, 'onSendAction'], $priority); }
/** * Attach to an event manager * * @param EventManagerInterface $events * @param integer $priority */ public function attach(EventManagerInterface $events) { $this->listeners[] = $events->attach(MvcEvent::EVENT_DISPATCH, array($this, 'flushDocumentManager'), -150); $this->listeners[] = $events->attach(MvcEvent::EVENT_DISPATCH_ERROR, array($this, 'onDispatchError'), 10); /* This is needed to handle cases where the DISPATCH event exists early due to shortCircuit check */ $this->listeners[] = $events->attach(MvcEvent::EVENT_FINISH, array($this, 'flushDocumentManager'), 150); }
/** * {@inheritDoc} */ public function attach(EventManagerInterface $events) { $sharedEvents = $events->getSharedManager(); $sharedEvents->attach('PI_CONTROLLER', MvcEvent::EVENT_DISPATCH, array($this, 'prepareErrorViewModel'), -85); $this->listeners[] = $events->attach(MvcEvent::EVENT_DISPATCH, array($this, 'prepareErrorViewModel'), -85); $this->listeners[] = $events->attach(MvcEvent::EVENT_RENDER, array($this, 'prepareErrorViewModel'), 100); }
/** * 注册事件监听器,由事件管理器回调。 * * @param EventManagerInterface $eventManager * @return AuthLoggerListener */ public function attach(EventManagerInterface $eventManager) { $this->listeners[] = $eventManager->attach(AuthEvent::EVENT_VERIFY_POST, array($this, 'onVerifyPost')); $this->listeners[] = $eventManager->attach(AuthEvent::EVENT_TOKEN_POST, array($this, 'onTokenPost')); $this->listeners[] = $eventManager->attach(AuthEvent::EVENT_FAILURE, array($this, 'onFailure')); return $this; }
public function attach(EventManagerInterface $events) { $this->listeners[] = $events->attach(MvcEvent::EVENT_DISPATCH_ERROR, array($this, 'detectError'), 100); $this->listeners[] = $events->attach(MvcEvent::EVENT_DISPATCH_ERROR, array($this, 'prepareViewModel'), -95); $this->listeners[] = $events->attach(MvcEvent::EVENT_RENDER_ERROR, array($this, 'detectError'), 100); $this->listeners[] = $events->attach(MvcEvent::EVENT_RENDER_ERROR, array($this, 'prepareViewModel'), -95); }