Detailed Description
ApplicationEvent instances are fired at different stages of the program flow.
Note that depending on the stage, some of the properties may be null, because they are not initialized yet (e.g. controller). Listening to this application events allows users to intercept the application flow and change it by modifying the requests and responses.
Definition at line 29 of file ApplicationEvent.php.
Public Member Functions | |
__construct ($stage, Request $request, Response $response=null, Controller $controller=null) | |
getStage () | |
getRequest () | |
getResponse () | |
getController () | |
Public Member Functions inherited from Event | |
stopPropagation () | |
isStopped () | |
Public Attributes | |
const | NAME = __CLASS__ |
const | BEFORE_ROUTE_ACTION = 'BEFORE_ROUTE_ACTION' |
const | BEFORE_INITIALIZE_CONTROLLER = 'BEFORE_INITIALIZE_CONTROLLER' |
const | BEFORE_EXECUTE_CONTROLLER = 'BEFORE_EXECUTE_CONTROLLER' |
const | AFTER_EXECUTE_CONTROLLER = 'AFTER_EXECUTE_CONTROLLER' |
Constructor & Destructor Documentation
◆ __construct()
__construct | ( | $stage, | |
Request | $request, | ||
Response | $response = null , |
||
Controller | $controller = null |
||
) |
Constructor.
- Parameters
-
$stage The stage at which the event occurred. $request The request instance. $response The response instance (optional). $controller The controller instance (optional).
Definition at line 70 of file ApplicationEvent.php.
Member Function Documentation
◆ getStage()
getStage | ( | ) |
Get the stage at which the event occurred.
- Returns
- String
Definition at line 81 of file ApplicationEvent.php.
◆ getRequest()
getRequest | ( | ) |
◆ getResponse()
getResponse | ( | ) |
◆ getController()
getController | ( | ) |
Member Data Documentation
◆ NAME
const NAME = __CLASS__ |
Definition at line 31 of file ApplicationEvent.php.
◆ BEFORE_ROUTE_ACTION
const BEFORE_ROUTE_ACTION = 'BEFORE_ROUTE_ACTION' |
A BEFORE_ROUTE_ACTION event occurs before the request is mapped to an action key.
The request data are in the original format at this stage.
Definition at line 38 of file ApplicationEvent.php.
◆ BEFORE_INITIALIZE_CONTROLLER
const BEFORE_INITIALIZE_CONTROLLER = 'BEFORE_INITIALIZE_CONTROLLER' |
A BEFORE_INITIALIZE_CONTROLLER event occurs before the current controller is initialized.
Definition at line 44 of file ApplicationEvent.php.
◆ BEFORE_EXECUTE_CONTROLLER
const BEFORE_EXECUTE_CONTROLLER = 'BEFORE_EXECUTE_CONTROLLER' |
A BEFORE_EXECUTE_CONTROLLER event occurs after the current controller is initialized and before it is executed.
Definition at line 50 of file ApplicationEvent.php.
◆ AFTER_EXECUTE_CONTROLLER
const AFTER_EXECUTE_CONTROLLER = 'AFTER_EXECUTE_CONTROLLER' |
A AFTER_EXECUTE_CONTROLLER event occurs after the current controller is executed.
Definition at line 56 of file ApplicationEvent.php.