Fr3nch13/CakePHP Utilities

EventDispatcherTrait

Implements Cake\Event\EventDispatcherInterface.

Table of Contents

Properties

$_eventClass  : string
Default class name for new event objects.
$_eventManager  : EventManagerInterface|null
Instance of the Cake\Event\EventManager this object is using to dispatch inner events.

Methods

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

Properties

$_eventClass

Default class name for new event objects.

protected string $_eventClass = \Cake\Event\Event::class

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

getEventManager()

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

public getEventManager() : EventManagerInterface

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.

Return values
EventManagerInterface

setEventManager()

Returns the Cake\Event\EventManagerInterface 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