Class Event
$_data protected array$_name protected string$_stopped protected boolean$_subject protected object|null$result public mixed__construct( string $name , object|null $subject = null , array|ArrayAccess|null $data = null )
Constructor
$event = new Event('Order.afterBuy', $this, ['buyer' => $userData]);
$event = new Event('User.afterRegister', $UserModel); $name $subject optional null $data optional null __get( string $attribute )
Provides read-only access for the name and subject properties.
$attribute __set( string $attribute , mixed $value )
Provides backward compatibility for write access to data and result properties.
$attribute $value data( string|null $key = null )
Access the event data/payload.
$key optional 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.
getData( string|null $key = null )
Access the event data/payload.
$key optional 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.
Cake\Event\EventInterface::getData() getName( )
Returns the name of this event. This is usually used as the event identifier
Cake\Event\EventInterface::getName() getResult( )
The result value of the event listeners
Cake\Event\EventInterface::getResult() getSubject( )
Returns the subject of this event
Cake\Event\EventInterface::getSubject() isStopped( )
Check if the event is stopped
Cake\Event\EventInterface::isStopped() name( )
Returns the name of this event. This is usually used as the event identifier
result( )
The result value of the event listeners
setData( array|string $key , mixed $value = null )
Assigns a value to the data/payload of this event.
$key $value optional null Cake\Event\EventInterface::setData() setResult( mixed $value = null )
Listeners can attach a result value to the event.
$value optional null Cake\Event\EventInterface::setResult() stopPropagation( )
Stops the event from being used anymore
Cake\Event\EventInterface::stopPropagation() subject( )
Returns the subject of this event
protected object|null
The object this event applies to (usually the same object that generates the event)
public mixed
Property used to retain the result value of the event listeners
Note: Public access is deprecated, use setResult() and getResult() instead.
© 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.8/class-Cake.Event.Event.html