ApplicationEvent Class Reference

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.

Author
ingo herwig ingo@.nosp@m.wemo.nosp@m.ve.co.nosp@m.m

Definition at line 29 of file ApplicationEvent.php.

+ Inheritance diagram for ApplicationEvent:

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
$stageThe stage at which the event occurred.
$requestThe request instance.
$responseThe response instance (optional).
$controllerThe 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 ( )

Get the request.

Returns
Request instance

Definition at line 89 of file ApplicationEvent.php.

◆ getResponse()

getResponse ( )

Get the response.

Returns
Response instance

Definition at line 97 of file ApplicationEvent.php.

◆ getController()

getController ( )

Get the controller.

Returns
Controller instance

Definition at line 105 of file ApplicationEvent.php.

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.