Axiom (v1.2.0)

A lightweight PHP framework
axBaseController Class Reference

Controller base class. More...

Static Public Member Functions

static _init (axRequest &$request, axResponse &$response)
 Initialize the controller with the request and response.

Static Protected Member Functions

static setRequest (axRequest &$request)
 Set the request object.
static setResponse (axResponse &$response)
static forward ($controller, $action="index")
 Forward the action to another controller.
static redirect ($url, $method=axRedirectException::REDIRECT_REFRESH)

Static Protected Attributes

static $_request
 Request object.
static $_response
 Response object.

Detailed Description

Controller base class.

All application controller should extend this class.

Warning:
All application controllers must have the Controller suffix (for instance ArticleController).
Author:
Delespierre

Definition at line 20 of file axBaseController.class.php.


Member Function Documentation

static axBaseController::_init ( axRequest &$  request,
axResponse &$  response 
) [static]

Initialize the controller with the request and response.

You may extend this method to provide custom initialization for your controller (for instance, to initialize a session).

Parameters:
axRequest$requestThe request object reference
axResponse$responseThe response object reference
Returns:
void

Definition at line 44 of file axBaseController.class.php.

static axBaseController::forward ( controller,
action = "index" 
) [static, final, protected]

Forward the action to another controller.

Calling this method will break the current execution call to continue the request processing on another controller/action couple. This is useful when you want to delegate a controller's action to another controller (for instance, display an HTTP error message using the ErrorController::http403).

Note:
The forwarding mechanism uses an axForwardException to break the execution flow. The exception thrown is supposed to be caught by the axRouter that will take the appropriate action according to the exception.
Parameters:
string$controllerThe controller to invoke
string$action[optional] [default "index"] The action to invoke
Exceptions:
RuntimeExceptionIf the controller to invoke is invalid
axForwardException
Returns:
void

Definition at line 86 of file axBaseController.class.php.

static axBaseController::redirect ( url,
method = axRedirectException::REDIRECT_REFRESH 
) [static, final, protected]

Triggers a redirection

This method works the same way axBaseController::forward does but the invoked action will be an HTTP redirection (permanent or refresh base according to the $method parameter, see axRedirectException for more details).

Parameters:
string$urlThe URL to redirect to
int$method[optional] [default axRedirectException::REDIRECT_REFRESH] The redirection method
Exceptions:
InvalidArgumentExceptionif the $url parameter is not a valid URL
axRedirectException
Returns:
void

Definition at line 111 of file axBaseController.class.php.

static axBaseController::setRequest ( axRequest &$  request) [static, final, protected]

Set the request object.

Parameters:
axRequest$requestThe request object reference
Returns:
void

Definition at line 55 of file axBaseController.class.php.

static axBaseController::setResponse ( axResponse &$  response) [static, final, protected]

Set the response object

Parameters:
axResponse$responseThe response object reference
Returns:
void

Definition at line 65 of file axBaseController.class.php.


Field Documentation

axRequest axBaseController::$_request [static, protected]

Request object.

Definition at line 26 of file axBaseController.class.php.

axResponse axBaseController::$_response [static, protected]

Response object.

Definition at line 32 of file axBaseController.class.php.


The documentation for this class was generated from the following file:
 All Data Structures Files Functions Variables