- Phalcon\Events\Event
- Phalcon\Events\EventInterface
- Phalcon\Events\EventsAwareInterface
- Phalcon\Events\Exception
- Phalcon\Events\Manager
- Phalcon\Events\ManagerInterface
Class Phalcon\Events\Event
| Namespace | Phalcon\Events | | Implements | EventInterface |
Phalcon\Events\Event
This class offers contextual information of a fired event in the EventsManager
Phalcon\Events\Event;
$event = new Event("db:afterQuery", $this, ["data" => "mydata"], true);
if ($event->isCancelable()) {
$event->stop();
}
Properties¶
/**
* Is event cancelable?
*
* @var bool
*/
protected cancelable;
/**
* Event data
*
* @var mixed
*/
protected data;
/**
* Event source
*
* @var object
*/
protected source;
/**
* Is event propagation stopped?
*
* @var bool
*/
protected stopped = false;
/**
* Event type
*
* @var string
*/
protected type;
Methods¶
public function __construct( string $type, object $source, mixed $data = null, bool $cancelable = bool );
Interface Phalcon\Events\EventInterface
| Namespace | Phalcon\Events |
Phalcon\Events\EventInterface
Interface for Phalcon\Events\Event class
Methods¶
Gets event data Gets event type Check whether the event is cancelable Check whether the event is currently stopped Sets event data Sets event type Stops the event preventing propagationInterface Phalcon\Events\EventsAwareInterface
| Namespace | Phalcon\Events |
Phalcon\Events\EventsAwareInterface
This interface must for those classes that accept an EventsManager and dispatch events
Methods¶
Returns the internal event manager Sets the events managerClass Phalcon\Events\Exception
| Namespace | Phalcon\Events | | Extends | \Phalcon\Exception |
Phalcon\Events\Exception
Exceptions thrown in Phalcon\Events will use this class
Class Phalcon\Events\Manager
| Namespace | Phalcon\Events | | Uses | Closure, SplPriorityQueue | | Implements | ManagerInterface |
Phalcon\Events\Manager
Phalcon Events Manager, offers an easy way to intercept and manipulate, if needed, the normal flow of operation. With the EventsManager the developer can create hooks or plugins that will offer monitoring of data, manipulation, conditional execution and much more.
Constants¶
Properties¶
/**
* @var bool
*/
protected collect = false;
/**
* @var bool
*/
protected enablePriorities = false;
//
protected events;
//
protected responses;
Methods¶
Returns if priorities are enabledpublic function attach( string $eventType, mixed $handler, int $priority = static-constant-access ): void;
A priority queue of events is a data structure similar to a regular queue of events: we can also put and extract elements from it. The difference is that each element in a priority queue is associated with a value called priority. This value is used to order elements of a queue: elements with higher priority are retrieved before the elements with lower priority.
public function fire( string $eventType, object $source, mixed $data = null, bool $cancelable = bool );
Interface Phalcon\Events\ManagerInterface
| Namespace | Phalcon\Events |
Phalcon\Events\ManagerInterface
Interface for Phalcon\Events managers.