\Cake\EventEventInterface

Represents the transport class of events across the system. It receives a name, subject and an optional payload. The name can be any string that uniquely identifies the event across the application, while the subject represents the object that the event applies to.

Summary

Methods
Constants
getName()
getSubject()
stopPropagation()
isStopped()
getResult()
setResult()
getData()
setData()
No constants found
No protected methods found
N/A
No private methods found
N/A

Methods

getName()

getName() : string

Returns the name of this event. This is usually used as the event identifier.

Returns

string

getSubject()

getSubject() : object

Returns the subject of this event.

Returns

object

stopPropagation()

stopPropagation() : void

Stops the event from being used anymore.

isStopped()

isStopped() : boolean

Checks if the event is stopped.

Returns

boolean —

True if the event is stopped

getResult()

getResult() : mixed

The result value of the event listeners.

Returns

mixed

setResult()

setResult(mixed  $value = null) : $this

Listeners can attach a result value to the event.

Parameters

mixed $value

The value to set.

Returns

$this

getData()

getData(string|null  $key = null) : array|mixed|null

Accesses the event data/payload.

Parameters

string|null $key

The data payload element to return, or null to return all data.

Returns

array|mixed|null —

The data payload if $key is null, or the data value for the given $key. If the $key does not exist a null value is returned.

setData()

setData(array|string  $key, mixed  $value = null) : $this

Assigns a value to the data/payload of this event.

Parameters

array|string $key

An array will replace all payload data, and a key will set just that array item.

mixed $value

The value to set.

Returns

$this