作者:alex-oleshkevic
项目:zf-extra
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']);
}
}
作者:decmad
项目:zendAbacAc
/**
*
* {@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);
}
作者:starflas
项目:MobilePf-ZF2-Exampl
/**
* 注册事件监听器,由事件管理器回调。
*
* @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;
}
作者:rostmefpote
项目:b
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']);
}
作者:zend-module
项目:localemanager_outdate
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);
}
作者:dotuanc
项目:secretar
/**
* @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'));
}
作者:thomasvargi
项目:pami-modul
/**
* 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);
}
作者:Andyyang198
项目:p
/**
* {@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);
}
作者:PoetikDrago
项目:USCS
/**
* @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']);
}
作者:old-tow
项目:zf2-test-toolki
/**
* @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);
}
作者:zealprojec
项目:zeal-or
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);
}
作者:parrotcag
项目:ave
/**
* 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);
}
作者:detailne
项目:dfw-commanding-modul
/**
* {@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);
}
作者:Flesh19
项目:magent
/**
* {@inheritdoc}
*/
public function attach(EventManagerInterface $events)
{
if (!$this->isEnabled()) {
return;
}
$this->listeners[] = $events->attach(MvcEvent::EVENT_ROUTE, array($this, 'onRoute'), 10000);
}
作者:butkimtin
项目:ZendSkeletonApplicatio
/**
* {@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);
}
作者:jackdpeterso
项目:SlmQueu
/**
* @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));
}
}
作者:arstropic
项目:zf-tenstree
public function attach(EventManagerInterface $events)
{
$sharedManager = $events->getSharedManager();
$this->listeners[] = $sharedManager->attach('ZfcUser\\Form\\Register', 'init', array($this, 'onRegisterForm'));
$this->listeners[] = $sharedManager->attach('ZfcUser\\Service\\User', 'register', array($this, 'onRegister'));
$this->listeners[] = $sharedManager->attach('ZfcUser\\Service\\User', 'register.post', array($this, 'onRegisterPost'));
}
作者:gridguy
项目:cor
/**
* 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);
}
作者:alex-oleshkevic
项目:zf-extra
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']);
}
作者:Flesh19
项目:magent
/**
* 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'));
}
}