本文整理匯總了PHP中Zend\EventManager\EventManagerInterface::attach方法的典型用法代碼示例。如果您正苦於以下問題:PHP EventManagerInterface::attach方法的具體用法?PHP EventManagerInterface::attach怎麽用?PHP EventManagerInterface::attach使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend\EventManager\EventManagerInterface
的用法示例。
在下文中一共展示了EventManagerInterface::attach方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: attach
/**
* @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']);
}
示例2: attach
/**
* 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'));
}
}
示例3: 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('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']);
}
示例4: 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);
}
示例5: 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'));
}
示例6: attach
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']);
}
示例7: attach
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);
}
示例8: 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']);
}
}
示例9: attach
/**
* 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);
}
示例10: attach
/**
* {@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);
}
示例11: attach
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);
}
示例12: attach
/**
* @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);
}
示例13: attach
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']);
}
示例14: attach
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);
}
示例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);
}