Use the EventManager when you want to create a per-instance notification
system for your objects.
Methods
Construct the validation chain
__construct(\Zend\Session\Storage\StorageInterface $storage)
Retrieves validators from session storage and attaches them.
Parameters
Add some identifier(s) (appends to any currently set identifiers)
addIdentifiers(string | int | array | \Traversable $identifiers) : \Zend\EventManager\EventManager
Inherited
inherited_from |
\Zend\EventManager\EventManager::addIdentifiers() |
Parameters
$identifiers
stringintarray\Traversable
Returns
Attach a listener to the session validator chain
attach(string $event, \Zend\Session\callable $callback, int $priority) : \Zend\Stdlib\CallbackHandler
The first argument is the event, and the next argument describes a
callback that will respond to that event. A CallbackHandler instance
describing the event listener combination will be returned.
The last argument indicates a priority at which the event should be
executed. By default, this value is 1; however, you may set it for any
integer value. Higher values have higher priority (i.e., execute first).
You can specify "*" for the event name. In such cases, the listener will
be triggered for every event.
Parameters
$event
string
$callback
\Zend\Session\callable
$priority
int
Exceptions
Returns
Attach a listener aggregate
attachAggregate(\Zend\EventManager\ListenerAggregateInterface $aggregate, int $priority) : mixed
Inherited
Listener aggregates accept an EventManagerInterface instance, and call attach()
one or more times, typically to attach to multiple events using local
methods.
inherited_from |
\Zend\EventManager\EventManager::attachAggregate() |
Parameters
$priority
int
If provided, a suggested priority for the aggregate to use
Returns
mixed
return value of {@link ListenerAggregateInterface::attach()}
Clear all listeners for a given event
clearListeners(string $event) : void
Inherited
inherited_from |
\Zend\EventManager\EventManager::clearListeners() |
Parameters
$event
string
Detach a listener aggregate
detachAggregate(\Zend\EventManager\ListenerAggregateInterface $aggregate) : mixed
Inherited
Listener aggregates accept an EventManagerInterface instance, and call detach()
of all previously attached listeners.
inherited_from |
\Zend\EventManager\EventManager::detachAggregate() |
Parameters
Returns
mixed
return value of {@link ListenerAggregateInterface::detach()}
Retrieve all registered events
getEvents() : array
Inherited
inherited_from |
\Zend\EventManager\EventManager::getEvents() |
Returns
array
Get the identifier(s) for this EventManager
getIdentifiers() : array
Inherited
inherited_from |
\Zend\EventManager\EventManager::getIdentifiers() |
Returns
array
Retrieve all listeners for a given event
getListeners(string $event) : \Zend\Stdlib\PriorityQueue
Inherited
inherited_from |
\Zend\EventManager\EventManager::getListeners() |
Parameters
$event
string
Returns
Get shared event manager
getSharedManager() : false | \Zend\EventManager\SharedEventManagerInterface
Inherited
If one is not defined, but we have a static instance in
StaticEventManager, that one will be used and set in this instance.
If none is available in the StaticEventManager, a boolean false is
returned.
inherited_from |
\Zend\EventManager\EventManager::getSharedManager() |
Returns
Prepare arguments
prepareArgs(array $args) : \ArrayObject
Inherited
Use this method if you want to be able to modify arguments from within a
listener. It returns an ArrayObject of the arguments, which may then be
passed to trigger().
inherited_from |
\Zend\EventManager\EventManager::prepareArgs() |
Parameters
$args
array
Returns
Set the event class to utilize
setEventClass(string $class) : \Zend\EventManager\EventManager
Inherited
inherited_from |
\Zend\EventManager\EventManager::setEventClass() |
Parameters
$class
string
Returns
Set the identifiers (overrides any currently set identifiers)
setIdentifiers(string | int | array | \Traversable $identifiers) : \Zend\EventManager\EventManager
Inherited
inherited_from |
\Zend\EventManager\EventManager::setIdentifiers() |
Parameters
$identifiers
stringintarray\Traversable
Returns
Set shared event manager
setSharedManager(\Zend\EventManager\SharedEventManagerInterface $sharedEventManager) : \Zend\EventManager\EventManager
Inherited
inherited_from |
\Zend\EventManager\EventManager::setSharedManager() |
Parameters
Returns
Trigger all listeners for a given event
trigger(string | \Zend\EventManager\EventInterface $event, string | object $target, array | \ArrayAccess $argv, null | \Zend\EventManager\callable $callback) : \Zend\EventManager\ResponseCollection
Inherited
Should allow handling the following scenarios:
- Passing Event object only
- Passing event name and Event object only
- Passing event name, target, and Event object
- Passing event name, target, and array|ArrayAccess of arguments
- Passing event name, target, array|ArrayAccess of arguments, and callback
inherited_from |
\Zend\EventManager\EventManager::trigger() |
Parameters
$target
stringobject
Object calling emit, or symbol describing target (such as static method name)
$argv
array\ArrayAccess
Array of arguments; typically, should be associative
$callback
null\Zend\EventManager\callable
Trigger listeners until return value of this callback evaluate to true
Exceptions
Returns
Trigger listeners until return value of one causes a callback to
evaluate to true
triggerUntil(string | \Zend\EventManager\EventInterface $event, string | object $target, array | \ArrayAccess $argv, \Zend\EventManager\callable $callback) : \Zend\EventManager\ResponseCollection
Inherited
Triggers listeners until the provided callback evaluates the return
value of one as true, or until all listeners have been executed.
inherited_from |
\Zend\EventManager\EventManager::triggerUntil() |
Parameters
$target
stringobject
Object calling emit, or symbol describing target (such as static method name)
$argv
array\ArrayAccess
Array of arguments; typically, should be associative
$callback
\Zend\EventManager\callable
Exceptions
Returns
Remove any shared event manager currently attached
unsetSharedManager() : void
Inherited
inherited_from |
\Zend\EventManager\EventManager::unsetSharedManager() |
Get list of all listeners attached to the shared event manager for
identifiers registered by this instance
getSharedListeners(string $event) : array
Inherited
inherited_from |
\Zend\EventManager\EventManager::getSharedListeners() |
Parameters
$event
string
Returns
array
Add listeners to the master queue of listeners
insertListeners(\Zend\Stdlib\PriorityQueue $masterListeners, array | \Traversable $listeners) : void
Inherited
Used to inject shared listeners and wildcard listeners.
inherited_from |
\Zend\EventManager\EventManager::insertListeners() |
Parameters
$listeners
array\Traversable
Trigger listeners
triggerListeners(string $event, \Zend\EventManager\EventInterface $e, null | \Zend\EventManager\callable $callback) : \Zend\EventManager\ResponseCollection
Inherited
Actual functionality for triggering listeners, to which trigger() delegate.
inherited_from |
\Zend\EventManager\EventManager::triggerListeners() |
Parameters
$callback
null\Zend\EventManager\callable
Returns
Properties
<p>Class representing the event being emitted</p>
$eventClass : string
Inherited
inherited_from |
\Zend\EventManager\EventManager::$$eventClass |
Subscribed events and their listeners
$events : array
Inherited
inherited_from |
\Zend\EventManager\EventManager::$$events |
Identifiers, used to pull shared signals from SharedEventManagerInterface instance
$identifiers : array
Inherited
inherited_from |
\Zend\EventManager\EventManager::$$identifiers |