Event manager: notification system

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

category Zend
package Zend_EventManager

 Methods

Attach a listener to an event

attach(string $event, \Zend\EventManager\callable $callback, int $priority) : \Zend\Stdlib\CallbackHandler

Parameters

$event

string

$callback

\Zend\EventManager\callable

$priority

int

Returns

Clear all listeners for a given event

clearListeners(string $event) : void

Parameters

$event

string

Detach a callback from a listener

detach(\Zend\Stdlib\CallbackHandler $listener) : bool

Parameters

Returns

bool

Get event collection on which this operates

getEventCollection() : \Zend\EventManager\EventManagerInterface

Retrieve list of events this object manages

getEvents() : array

Returns

array

Retrieve all listeners for a given event

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

Parameters

$event

string

Returns

Set the event collection on which this will operate

setEventCollection(\Zend\EventManager\EventManagerInterface $events) : void

Trigger an event

trigger(string $event, object | string $context, array | object $argv) : \Zend\EventManager\ResponseCollection

Parameters

$event

string

$context

objectstring

$argv

arrayobject

Returns

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

triggerUntil(string $event, string | object $context, array | object $argv, \Zend\EventManager\callable $callback) : \Zend\EventManager\ResponseCollection

Parameters

$event

string

$context

stringobject

$argv

arrayobject

$callback

\Zend\EventManager\callable

Returns

 Properties