Interface EventInterface
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.
Direct Implementers
Magic properties summary
-
$data
public(deprecated) Custom data for the method that receives the eventarray
-
$name
public(deprecated) Name of the eventstring
-
$result
public(deprecated) Property used to retain the result value of the event listenersmixed
-
$subject
public(deprecated) The object this event applies toobject
Method Summary
- getData() publicAccesses the event data/payload.
- getName() publicReturns the name of this event. This is usually used as the event identifier.
- getResult() publicThe result value of the event listeners.
- getSubject() publicReturns the subject of this event.
- isStopped() publicChecks if the event is stopped.
- setData() publicAssigns a value to the data/payload of this event.
- setResult() publicListeners can attach a result value to the event.
- stopPropagation() publicStops the event from being used anymore.
Method Detail
getData()source public
getData( string|null $key = null )
Accesses the event data/payload.
Parameters
- string|null
$key
optional null - The data payload element to return, or null to return all data.
Returns
array|mixed|nullThe 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.
getName()source public
getName( )
Returns the name of this event. This is usually used as the event identifier.
Returns
stringisStopped()source public
isStopped( )
Checks if the event is stopped.
Returns
booleanTrue if the event is stopped
setData()source public
setData( array|string $key , mixed $value = null )
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
optional null - The value to set.
Returns
$this
setResult()source public
setResult( mixed $value = null )
Listeners can attach a result value to the event.
Parameters
- mixed
$value
optional null - The value to set.
Returns
$this
Magic properties detail
$datasource
public array
$namesource
public string
$resultsource
public mixed
$subjectsource
public object
© 2005–present 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.
https://api.cakephp.org/3.7/class-Cake.Event.EventInterface.html