Class CakeEvent
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.
Package: Cake\Event
Copyright: Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
License: MIT License
Location: Cake/Event/CakeEvent.php
Copyright: Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
License: MIT License
Location: Cake/Event/CakeEvent.php
Properties summary
-
$_name
protectedstring
Name of the event -
$_stopped
protectedboolean
Flags an event as stopped or not, default is false -
$_subject
protectedobject
The object this event applies to (usually the same object that generates the event) -
$data
publicmixed
Custom data for the method that receives the event -
$result
publicmixed
Property used to retain the result value of the event listeners
Method Summary
-
__construct() public
Constructor -
__get() public
Dynamically returns the name and subject if accessed directly -
isStopped() public
Check if the event is stopped -
name() public
Returns the name of this event. This is usually used as the event identifier -
stopPropagation() public
Stops the event from being used anymore -
subject() public
Returns the subject of this event
Method Detail
__construct() public ¶
__construct( string $name , object $subject = null , mixed $data = null )
Constructor
Parameters
- string $name
- Name of the event
- object $subject optional null
- the object that this event applies to (usually the object that is generating the event)
- mixed $data optional null
any value you wish to be transported with this event to it can be read by listeners
Examples of usage:
$event = new CakeEvent('Order.afterBuy', $this, array('buyer' => $userData)); $event = new CakeEvent('User.afterRegister', $UserModel);
__get() public ¶
__get( string $attribute )
Dynamically returns the name and subject if accessed directly
Parameters
- string $attribute
- Attribute name.
Returns
mixed
isStopped() public ¶
isStopped( )
Check if the event is stopped
Returns
boolean
True if the event is stopped
True if the event is stopped