本文整理匯總了PHP中Zend\EventManager\EventManagerInterface類的典型用法代碼示例。如果您正苦於以下問題:PHP EventManagerInterface類的具體用法?PHP EventManagerInterface怎麽用?PHP EventManagerInterface使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了EventManagerInterface類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: attach
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']);
}
}
示例2: attach
/**
*
* {@inheritDoc}
* @see \Zend\EventManager\ListenerAggregateInterface::attach()
*/
public function attach(EventManagerInterface $em)
{
/*
* attach the onDipatch() method to the MvcEvent::EVENT_DISPATCH event
*/
$this->listeners[] = $em->attach(MvcEvent::EVENT_DISPATCH, array($this, 'onDispatch'), 100);
}
示例3: attach
/**
* 注冊事件監聽器,由事件管理器回調。
*
* @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;
}
示例4: attach
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']);
}
示例5: attach
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);
}
示例6: attach
/**
* @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'));
}
示例7: attach
/**
* 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);
}
示例8: attach
/**
* {@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);
}
示例9: attach
/**
* @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']);
}
示例10: attach
/**
* @param EventManagerInterface $events
*
* @return ServiceListener
*/
public function attach(EventManagerInterface $events)
{
if (is_callable($this->overrideAppConfigHandler)) {
$this->listeners[] = $events->attach(ModuleEvent::EVENT_LOAD_MODULES_POST, $this->overrideAppConfigHandler);
}
parent::attach($events);
}
示例11: attach
public function attach(EventManagerInterface $events)
{
$sharedEvents = $events->getSharedManager();
$this->listeners[] = $sharedEvents->attach($this->attachTo, array('find.pre', 'fetchObject.pre'), array($this, 'checkCache'), 500);
$this->listeners[] = $sharedEvents->attach($this->attachTo, array('find.post', 'fetchObject.post'), array($this, 'storeInCache'), -500);
$this->listeners[] = $sharedEvents->attach($this->attachTo, array('update.post', 'delete.post'), array($this, 'removeFromCache'), 500);
}
示例12: attach
/**
* 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);
}
示例13: attach
/**
* {@inheritDoc}
*/
public function attach(EventManagerInterface $events, $priority = 1)
{
// $this->listeners[] = $events->attach(
// CommandDispatcherEvent::EVENT_PRE_HANDLE, array($this, 'onPreHandle'), $priority
// );
$this->listeners[] = $events->attach(CommandDispatcherEvent::EVENT_DISPATCH, array($this, 'onDispatch'), $priority);
}
示例14: attach
/**
* {@inheritdoc}
*/
public function attach(EventManagerInterface $events)
{
if (!$this->isEnabled()) {
return;
}
$this->listeners[] = $events->attach(MvcEvent::EVENT_ROUTE, array($this, 'onRoute'), 10000);
}
示例15: attach
/**
* {@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);
}