The event manager is responsible for keeping track of event listeners, passing the correct data to them, and firing them in the correct order, when associated events are triggered. You can create multiple instances of this object to manage local events or keep a single instance and pass it around to manage all events in your app.
_attachSubscriber( CakeEventListener $subscriber )
Auxiliary function to attach all implemented callbacks of a CakeEventListener class instance as individual methods on this manager
CakeEventListener $subscriber _detachSubscriber( CakeEventListener $subscriber , string $eventKey null )
Auxiliary function to help detach all listeners provided by an object implementing CakeEventListener
CakeEventListener $subscriber $eventKey optional null _extractCallable( array $function , CakeEventListener $object )
Auxiliary function to extract and return a PHP callback type out of the callable definition from the return value of the implementedEvents method on a CakeEventListener
$function CakeEventListener $object callableattach( callable|CakeEventListener $callable , string $eventKey null , array $options array() )
Adds a new listener to an event. Listeners
CakeEventListener $callable implementedEvents method will be called on the object to register the declared events individually as methods to be managed by this class. It is possible to define multiple event handlers per event name.$eventKey optional null $options optional array() priority and passParams flags to the listener. Priorities are handled like queues, and multiple attachments added to the same priority queue will be treated in the order of insertion. passParams means that the event data property will be converted to function arguments when the listener is called. If $called is an instance of CakeEventListener, this parameter will be ignoredInvalidArgumentExceptiondetach( callable|CakeEventListener $callable , string $eventKey null )
Removes a listener from the active listeners.
CakeEventListener $callable $eventKey optional null dispatch( string|CakeEvent $event )
Dispatches a new event to all configured listeners
CakeEvent $event CakeEventinstance( CakeEventManager $manager null )
Returns the globally available instance of a CakeEventManager this is used for dispatching events attached from outside the scope other managers were created. Usually for creating hook systems or inter-class communication
If called with the first parameter, it will be set as the globally available instance
CakeEventManager $manager optional null CakeEventManagerlisteners( string $eventKey )
Returns a list of all listeners for an eventKey in the order they should be called
$eventKey arrayprioritisedListeners( string $eventKey )
Returns the listeners for the specified event key indexed by priority
$eventKey array
© 2005–2016 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
http://api.cakephp.org/2.7/class-CakeEventManager.html