Event manager: notification system

Use the EventManager when you want to create a per-instance notification system for your objects.

package Default

 Methods

Attach a listener to an event

attach(string $event, callable $callback, integer $priority = 1) : \Zend\Stdlib\CallbackHandler
Static

Parameters

$event

string

$callback

callable

$priority

integer

Returns

\Zend\Stdlib\CallbackHandler

Clear all listeners for a given event

clearListeners(string $event) : void
Static

Parameters

$event

string

Detach a callback from a listener

detach(\Zend\Stdlib\CallbackHandler $listener) : boolean
Static

Parameters

$listener

\Zend\Stdlib\CallbackHandler

Returns

boolean

Get event collection on which this operates

getEventCollection() : \Zend\EventManager\EventManagerInterface
Static

Returns

\Zend\EventManager\EventManagerInterface

Retrieve list of events this object manages

getEvents() : array
Static

Returns

array

Retrieve all listeners for a given event

getListeners(string $event) : \Zend\Stdlib\PriorityQueue | array
Static

Parameters

$event

string

Returns

\Zend\Stdlib\PriorityQueuearray

Set the event collection on which this will operate

setEventCollection(null|\Zend\EventManager\EventManagerInterface $events = null) : void
Static

Parameters

$events

null\Zend\EventManager\EventManagerInterface

Trigger an event

trigger(string $event, object|string $context, array|object $argv = array(), null|callable $callback = null) : \Zend\EventManager\ResponseCollection
Static

Parameters

$event

string

$context

objectstring

$argv

arrayobject

$callback

nullcallable

Returns

\Zend\EventManager\ResponseCollection

Trigger listeners until return value of one causes a callback to evaluate to true.

triggerUntil(string $event, string|object $context, array|object $argv, callable $callback) : \Zend\EventManager\ResponseCollection
Static
deprecated Please use trigger()

Parameters

$event

string

$context

stringobject

$argv

arrayobject

$callback

callable

Returns

\Zend\EventManager\ResponseCollection

 Properties

 

$events

$events : \Zend\EventManager\EventManagerInterface

Default

Static