category | Zend |
---|---|
package | Zend_Controller |
copyright | Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) |
license | New BSD License |
__call(string $methodName, array $args) : void
string
array
\Zend_Controller_Action_Exception |
---|
__construct(\Zend_Controller_Request_Abstract $request, \Zend_Controller_Response_Abstract $response, array $invokeArgs = array()
) : void
The request and response objects should be registered with the controller, as should be any additional optional arguments; these will be available via \getRequest(), \getResponse(), and \getInvokeArgs(), respectively.
When overriding the constructor, please consider this usage as a best practice and ensure that each is registered appropriately; the easiest way to do so is to simply call parent::__construct($request, $response, $invokeArgs).
After the request, response, and invokeArgs are set, the \$_helper is initialized.
Finally, \init() is called as the final action of instantiation, and may be safely overridden to perform initialization tasks; as a general rule, override \init() instead of the constructor to customize an action controller's instantiation.
inherited_from | \Zend_Controller_Action_Interface::__construct() |
---|
\Zend_Controller_Request_Abstract
\Zend_Controller_Response_Abstract
array
Any additional invocation arguments
dispatch(string $action) : void
inherited_from | \Zend_Controller_Action_Interface::dispatch() |
---|
string
Method name of action
forward(string $action, string $controller= null
, string $module= null
, array $params= null
) : void
It is important to supply the unformatted names, i.e. "article" rather than "ArticleController". The dispatcher will do the appropriate formatting when the request is received.
If only an action name is provided, forwards to that action in this controller.
If an action and controller are specified, forwards to that action and controller in this module.
Specifying an action, controller, and module is the most specific way to forward.
A fourth argument, $params, will be used to set the request parameters. If either the controller or module are unnecessary for forwarding, simply pass null values for them before specifying the parameters.
string
string
string
array
getAllParams() : array
array
getFrontController() : \Zend_Controller_Front
\Zend_Controller_Front
getHelper(string $helperName) : \Zend_Controller_Action_Helper_Abstract
string
\Zend_Controller_Action_Helper_Abstract
getHelperCopy(string $helperName) : \Zend_Controller_Action_Helper_Abstract
string
\Zend_Controller_Action_Helper_Abstract
getInvokeArg(string $key) : mixed
string
mixed
getInvokeArgs() : array
array
getParam(string $paramName, mixed $default = null
) : mixed
If the parameter does not exist and $default is set, then $default will be returned instead of NULL.
string
mixed
mixed
getRequest() : \Zend_Controller_Request_Abstract
\Zend_Controller_Request_Abstract
getResponse() : \Zend_Controller_Response_Abstract
\Zend_Controller_Response_Abstract
getViewScript(string $action= null
, boolean $noController= null
) : string
Used by render() to determine the path to the view script.
string
Defaults to action registered in request object
boolean
Defaults to false; i.e. use controller name as subdir in which to search for view script
\Zend_Controller_Exception |
with bad $action |
---|
string
hasParam(string $paramName) : boolean
string
boolean
init() : void
Called from __construct() as final step of object instantiation.
initView() : \Zend_View_Interface
Initializes \$view if not otherwise a Zend_View_Interface.
If \$view is not otherwise set, instantiates a new Zend_View object, using the 'views' subdirectory at the same level as the controller directory for the current module as the base directory. It uses this to set the following:
\Zend_Controller_Exception |
if base view directory does not exist |
---|
\Zend_View_Interface
postDispatch() : void
Called after action method execution. If using class with Zend_Controller_Front, it may modify the \$_request and reset its dispatched flag in order to process an additional action.
Common usages for postDispatch() include rendering content in a sitewide template, link url correction, setting headers, etc.
preDispatch() : void
Called before action method. If using class with Zend_Controller_Front, it may modify the \$_request and reset its dispatched flag in order to skip processing the current action.
redirect(string $url, array $options = array()
) : void
string
array
Options to be used when redirecting
render(string|null $action= null
, string|null $name= null
, boolean $noController= false
) : void
Renders a view. By default, views are found in the view script path as
see |
---|
string
null
Defaults to action registered in request object
string
null
Response object named path segment to use; defaults to null
boolean
Defaults to false; i.e. use controller name as subdir in which to search for view script
renderScript(string $script, string $name = null
) : void
Similar to \render(), this method renders a view script. Unlike render(), however, it does not autodetermine the view script via \getViewScript(), but instead renders the script passed to it. Use this if you know the exact view script name and path you wish to use, or if using paths that do not conform to the spec defined with getViewScript().
By default, the rendered contents are appended to the response. You may specify the named body content segment to set by specifying a $name.
string
string
run(null|\Zend_Controller_Request_Abstract $request= null
, null|\Zend_Controller_Response_Abstract $response= null
) : \Zend_Controller_Response_Abstract
Not used in the Action Controller implementation, but left for usage in Page Controller implementations. Dispatches a method based on the request.
Returns a Zend_Controller_Response_Abstract object, instantiating one prior to execution if none exists in the controller.
\preDispatch() is called prior to the action, \postDispatch() is called following it.
null
\Zend_Controller_Request_Abstract
Optional request object to use
null
\Zend_Controller_Response_Abstract
Optional response object to use
\Zend_Controller_Response_Abstract
setFrontController(\Zend_Controller_Front $front) : \Zend_Controller_Action
\Zend_Controller_Front
\Zend_Controller_Action
setParam(string $paramName, mixed $value) : \Zend_Controller_Action
string
mixed
\Zend_Controller_Action
setRequest(\Zend_Controller_Request_Abstract $request) : \Zend_Controller_Action
\Zend_Controller_Request_Abstract
\Zend_Controller_Action
setResponse(\Zend_Controller_Response_Abstract $response) : \Zend_Controller_Action
\Zend_Controller_Response_Abstract
\Zend_Controller_Action
_forward(string $action, string $controller= null
, string $module= null
, array $params= null
) : void
It is important to supply the unformatted names, i.e. "article" rather than "ArticleController". The dispatcher will do the appropriate formatting when the request is received.
If only an action name is provided, forwards to that action in this controller.
If an action and controller are specified, forwards to that action and controller in this module.
Specifying an action, controller, and module is the most specific way to forward.
A fourth argument, $params, will be used to set the request parameters. If either the controller or module are unnecessary for forwarding, simply pass null values for them before specifying the parameters.
deprecated | Deprecated as of Zend Framework 1.7. Use forward() instead. |
---|
string
string
string
array
_getAllParams() : array
deprecated | Deprecated as of Zend Framework 1.7. Use getAllParams() instead. |
---|
array
_getParam(string $paramName, mixed $default = null
) : mixed
If the parameter does not exist and $default is set, then $default will be returned instead of NULL.
string
mixed
mixed
_hasParam(string $paramName) : boolean
deprecated | Deprecated as of Zend Framework 1.7. Use hasParam() instead. |
---|
string
boolean
_redirect(string $url, array $options = array()
) : void
deprecated | Deprecated as of Zend Framework 1.7. Use redirect() instead. |
---|
string
array
Options to be used when redirecting
_setInvokeArgs(array $args = array()
) : \Zend_Controller_Action
array
\Zend_Controller_Action
_setParam(string $paramName, mixed $value) : \Zend_Controller_Action
deprecated | Deprecated as of Zend Framework 1.7. Use setParam() instead. |
---|
string
mixed
\Zend_Controller_Action
$view : \Zend_View_Interface
$_classMethods : array
$_delimiters : array
$_frontController : \Zend_Controller_Front
$_helper : \Zend_Controller_Action_HelperBroker
null
$_invokeArgs : array
array()
$_request : \Zend_Controller_Request_Abstract
null
$_response : \Zend_Controller_Response_Abstract
null