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. |
Controller base class.
All application controller should extend this class.
Definition at line 20 of file axBaseController.class.php.
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).
axRequest | $request | The request object reference |
axResponse | $response | The response object reference |
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).
string | $controller | The controller to invoke |
string | $action | [optional] [default "index" ] The action to invoke |
RuntimeException | If the controller to invoke is invalid |
axForwardException |
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).
string | $url | The URL to redirect to |
int | $method | [optional] [default axRedirectException::REDIRECT_REFRESH ] The redirection method |
InvalidArgumentException | if the $url parameter is not a valid URL |
axRedirectException |
Definition at line 111 of file axBaseController.class.php.
static axBaseController::setRequest | ( | axRequest &$ | request | ) | [static, final, protected] |
Set the request object.
axRequest | $request | The request object reference |
Definition at line 55 of file axBaseController.class.php.
static axBaseController::setResponse | ( | axResponse &$ | response | ) | [static, final, protected] |
Set the response object
axResponse | $response | The response object reference |
Definition at line 65 of file axBaseController.class.php.
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.