Fr3nch13/CakePHP Utilities

EventDispatcherInterface

Objects implementing this interface can emit events.

Objects with this interface can trigger events, and have an event manager retrieved from them.

The lets you easily implement this interface.

Table of Contents

Methods

dispatchEvent()  : EventInterface
Wrapper for creating and dispatching events.
getEventManager()  : EventManagerInterface
Returns the Cake\Event\EventManager manager instance for this object.
setEventManager()  : $this
Sets the Cake\Event\EventManager manager instance for this object.

Methods

dispatchEvent()

Wrapper for creating and dispatching events.

public dispatchEvent(string $name[, array<string|int, mixed>|null $data = null ][, object|null $subject = null ]) : EventInterface

Returns a dispatched event.

Parameters
$name : string

Name of the event.

$data : array<string|int, mixed>|null = null

Any value you wish to be transported with this event to it can be read by listeners.

$subject : object|null = null

The object that this event applies to ($this by default).

Return values
EventInterface

setEventManager()

Sets the Cake\Event\EventManager manager instance for this object.

public setEventManager(EventManagerInterface $eventManager) : $this

You can use this instance to register any new listeners or callbacks to the object events, or create your own events and trigger them at will.

Parameters
$eventManager : EventManagerInterface

the eventManager to set

Return values
$this

        
On this page

Search results