Zend Framework
1.12
|
Public Member Functions | |
attach ($id, $event, $callback, $priority=1) | |
Attach a listener to an event. | |
detach ($id, Zend_Stdlib_CallbackHandler $listener) | |
Detach a listener from an event offered by a given resource. | |
getEvents ($id) | |
Retrieve all registered events for a given resource. | |
getListeners ($id, $event) | |
Retrieve all listeners for a given identifier and event. | |
clearListeners ($id, $event=null) | |
Clear all listeners for a given identifier, optionally for a specific event. | |
Protected Attributes | |
$identifiers = array() | |
attach | ( | $id, | |
$event, | |||
$callback, | |||
$priority = 1 |
|||
) |
Attach a listener to an event.
Allows attaching a callback to an event offerred by one or more identifying components. As an example, the following connects to the "getAll" event of both an AbstractResource and EntityResource:
SharedEventManager::getInstance()->connect( array('My', 'My'), 'getOne', function ($e) use ($cache) { if (!$id = $e->getParam('id', false)) { return; } if (!$data = $cache->load(get_class($resource) . '::getOne::' . $id )) { return; } return $data; } );
string | array | $id | Identifier(s) for event emitting component(s) |
string | $event | |
callback | $callback | PHP Callback |
int | $priority | Priority at which listener should execute |
clearListeners | ( | $id, | |
$event = null |
|||
) |
Clear all listeners for a given identifier, optionally for a specific event.
string | int | $id | |
null | string | $event |
detach | ( | $id, | |
Zend_Stdlib_CallbackHandler | $listener | ||
) |
Detach a listener from an event offered by a given resource.
string | int | $id | |
Zend_Stdlib_CallbackHandler | $listener |
getEvents | ( | $id | ) |
Retrieve all registered events for a given resource.
string | int | $id |
getListeners | ( | $id, | |
$event | |||
) |
Retrieve all listeners for a given identifier and event.
string | int | $id | |
string | int | $event |
Implements Zend_EventManager_SharedEventCollection.
|
protected |