implements Phalcon\Events\ManagerInterface
Phalcon Events Manager, offers an easy way to intercept and manipulate, if needed, the normal flow of operation. With the EventsManager the developer can create hooks or plugins that will offer monitoring of data, manipulation, conditional execution and much more.
public attach (string $eventType, callable $handler, [int $priority])
Attach a listener to the events manager
public enablePriorities (boolean $enablePriorities)
Set if priorities are enabled in the EventsManager
public boolean arePrioritiesEnabled ()
Returns if priorities are enabled
public collectResponses (boolean $collect)
Tells the event manager if it needs to collect all the responses returned by every registered listener in a single fire
public isCollecting ()
Check if the events manager is collecting all all the responses returned by every registered listener in a single fire
public array getResponses ()
Returns all the responses returned by every handler executed by the last ‘fire’ executed
public detach (unknown $eventType, object|callable $handler)
Detach a listener from the events manager
public detachAll ([unknown $eventType])
Removes all events from the EventsManager
public mixed fireQueue (SplPriorityQueue $queue, Phalcon\Events\Event $event, [boolean $flag], [mixed $prevData])
Internal handler to call a queue of events
public Phalcon\Events\Event createEvent (unknown $eventType, object $source, [mixed $data], [boolean $cancelable], [boolean $flag])
Create an event
public mixed fire (unknown $event, object $source, [mixed $data], [int $cancelable], [int $flag])
Fires an event in the events manager causing that active listeners be notified about it
<?php
$eventsManager->fire('db', $connection);
public boolean hasListeners (string $type)
Check whether certain type of event has listeners
public array getListeners (unknown $eventType, [boolean $full])
Returns all the attached listeners of a certain type
public array getEvents ()
Retrieve all registered events
public Phalcon\Events\Event getCurrentEvent ()
Gets current event
public dettachAll ([unknown $eventType])
...
public clearListeners ([unknown $eventType])
...