本文整理汇总了PHP中Zend\EventManager\SharedEventManagerInterface类的典型用法代码示例。如果您正苦于以下问题:PHP SharedEventManagerInterface类的具体用法?PHP SharedEventManagerInterface怎么用?PHP SharedEventManagerInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SharedEventManagerInterface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: detachShared
/**
* Detach all our listeners from the event manager
*
* @param SharedEventManagerInterface $events
* @return void
*/
public function detachShared(SharedEventManagerInterface $events)
{
if ($events->detach('Zend\\Mvc\\Application', $this->listener)) {
$this->listener = null;
}
return true;
}
示例2: detachShared
/**
* {@inheritDoc}
*/
public function detachShared(SharedEventManagerInterface $events)
{
foreach ($this->listeners as $listener) {
$events->detach(self::EVENT_IDENTIFIER, $listener);
}
unset($this->listeners);
}
示例3: 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);
}
示例4: detachShared
/**
* @param SharedEventManagerInterface $events
*/
public function detachShared(SharedEventManagerInterface $events)
{
foreach ($this->sharedListeners as $index => $listener) {
if ($events->detach('ZF\\Rest\\RestController', $listener)) {
unset($this->sharedListeners[$index]);
}
}
}
示例5: detachShared
/**
* {@inheritdoc}
*/
public function detachShared(SharedEventManagerInterface $events)
{
foreach ($this->listeners as $id => $listener) {
if ($events->detach($id, $listener)) {
unset($this->listeners[$id]);
}
}
}
示例6: 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;
}
示例7: detachShared
/**
* @inheritdoc
*/
public function detachShared(SharedEventManagerInterface $events)
{
foreach ($this->listeners as $index => $listener) {
if ($events->detach(AclService::class, $listener)) {
unset($this->listeners[$index]);
}
}
}
示例8: detachShared
public function detachShared(SharedEventManagerInterface $events)
{
foreach ($this->sharedListeners as $index => $listener) {
if ($events->detach($this->eventIdentifier, $listener)) {
unset($this->sharedListeners[$index]);
}
}
}
示例9: 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']);
}
示例10: 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']);
}
示例11: detachShared
/**
* @inheritdoc
*/
public function detachShared(SharedEventManagerInterface $events)
{
foreach ($this->listeners as $index => $listener) {
if ($events->detach(AbstractActionController::class, $listener)) {
unset($this->listeners[$index]);
}
}
}
示例12: detachShared
public function detachShared(SharedEventManagerInterface $events)
{
foreach ($this->listeners as $index => $callback) {
if ($events->dettach($callback)) {
unset($this->listeners[$index]);
}
}
}
示例13: detachShared
public function detachShared(\Zend\EventManager\SharedEventManagerInterface $events)
{
foreach ($this->listeners as $index => $listener) {
if ($events->detach($this->getMonitoredClass(), $listener)) {
unset($this->listeners[$index]);
}
}
}
示例14: 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__;
}
示例15: 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;
}