Abstract Class Zend_Controller_Action

Description
  • abstract:
  • license: New BSD License
  • copyright: Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)

Located in /Zend/Controller/Action.php (line 38)


	
			
Variable Summary
Method Summary
 void __construct (Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, [ $invokeArgs = array()])
 mixed getInvokeArg (string $key)
 array getInvokeArgs ()
 bool getRedirectExit ()
 void init ()
 void postDispatch ()
 void preDispatch ()
 true _checkRedirectCode (int $code)
 void _forward (string $controllerName, string $actionName, [array $params = array()])
 array _getAllParams ()
 mixed _getParam (string $paramName, [mixed $default = null])
 boolean _hasParam (string $paramName)
 void _redirect (string $url, [ $options = null])
 Zend_Controller_Action _setInvokeArgs ([ $args = array()])
 Zend_Controller_Action _setParam (string $paramName, mixed $value)
 void __call (string $methodName, array $args)
Variables
array $_invokeArgs = array() (line 45)

Array of arguments provided to the constructor, minus the $_request.

  • access: protected
int $_redirectCode = 302 (line 51)

HTTP status code for redirects

  • access: protected
bool $_redirectExit = true (line 57)

Whether or not calls to _redirect() should exit script execution

  • access: protected
bool $_redirectPrependBase = true (line 64)

Whether or not _redirect() should attempt to prepend the base URL to the

passed URL (if it's a relative URL)

  • access: protected
Zend_Controller_Request_Abstract $_request = null (line 70)

Zend_Controller_Request_Abstract object wrapping the request environment

  • access: protected
Zend_Controller_Response_Abstract $_response = null (line 76)

Zend_Controller_Response_Abstract object wrapping the response

  • access: protected
Methods
Constructor __construct (line 99)

Class constructor

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.

Additionally, 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.

  • access: public
void __construct (Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, [ $invokeArgs = array()])
getInvokeArg (line 190)

Return a single invocation argument

  • access: public
mixed getInvokeArg (string $key)
  • string $key
getInvokeArgs (line 179)

Return the array of constructor arguments (minus the Request object)

  • access: public
array getInvokeArgs ()
getRedirectCode (line 204)

Retrieve HTTP status code to emit on _redirect() call

  • access: public
int getRedirectCode ()
getRedirectExit (line 243)

Retrieve flag for whether or not _redirect() will exit when finished.

  • access: public
bool getRedirectExit ()
getRedirectPrependBase (line 266)

Retrieve flag for whether or not _redirect() will prepend the base URL on relative URLs

  • access: public
bool getRedirectPrependBase ()
getRequest (line 123)

Return the Request object

  • access: public
getResponse (line 145)

Return the Response object

  • access: public
init (line 114)

Initialize object

Called from __construct() as final step of object instantiation.

  • access: public
void init ()
postDispatch (line 310)

Post-dispatch routines

Called after action method execution. If using class with Zend_Controller_Front, it may modify the Request object 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.

  • access: public
void postDispatch ()
preDispatch (line 293)

Pre-dispatch routines

Called before action method. If using class with Zend_Controller_Front, it may modify the Request object and reset its dispatched flag in order to skip processing the current action.

  • access: public
void preDispatch ()
run (line 355)

Call the action specified in the request object, and return a response

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.

  • access: public
setRedirectCode (line 231)

Retrieve HTTP status code for _redirect() behaviour

  • access: public
Zend_Controller_Action setRedirectCode (int $code)
  • int $code
setRedirectExit (line 254)

Retrieve exit flag for _redirect() behaviour

  • access: public
Zend_Controller_Action setRedirectExit (bool $flag)
  • bool $flag
setRedirectPrependBase (line 277)

Retrieve 'prepend base' flag for _redirect() behaviour

  • access: public
Zend_Controller_Action setRedirectPrependBase (bool $flag)
  • bool $flag
setRequest (line 134)

Set the Request object

  • access: public
setResponse (line 156)

Set the Response object

  • access: public
_checkRedirectCode (line 215)

Validate HTTP status redirect code

  • access: protected
true _checkRedirectCode (int $code)
  • int $code
_forward (line 451)

Forward to another controller/action.

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.

  • access: protected
void _forward (string $controllerName, string $actionName, [array $params = array()])
  • string $controllerName
  • string $actionName
  • array $params
_getAllParams (line 433)

Return all parameters in the $_request as an associative array.

  • access: protected
array _getAllParams ()
_getParam (line 391)

Gets a parameter from the $_request. If the parameter does not exist, NULL will be returned.

If the parameter does not exist and $default is set, then $default will be returned instead of NULL.

  • access: protected
mixed _getParam (string $paramName, [mixed $default = null])
  • string $paramName
  • mixed $default
_hasParam (line 422)

Determine whether a given parameter exists in the $_request.

  • access: protected
boolean _hasParam (string $paramName)
  • string $paramName
_redirect (line 484)

Redirect to another URL

By default, emits a 302 HTTP status header, prepends base URL as defined in request object if url is relative, and halts script execution by calling exit().

$options is an optional associative array that can be used to control redirect behaviour. The available option keys are:

  • exit: boolean flag indicating whether or not to halt script execution when done
  • prependBase: boolean flag indicating whether or not to prepend the base URL when a relative URL is provided
  • code: integer HTTP status code to use with redirect. Should be between 300 and 307.
_redirect() sets the Location header in the response object. If you set the exit flag to false, you can override this header later in code execution.

If the exit flag is true (true by default), _redirect() will write and close the current session, if any.

  • access: protected
void _redirect (string $url, [ $options = null])
  • string $url
  • array $options: Options to be used when redirecting
_setInvokeArgs (line 168)

Set invocation arguments

  • access: protected
Zend_Controller_Action _setInvokeArgs ([ $args = array()])
  • array $args
_setParam (line 408)

Set a parameter in the $_request.

  • access: protected
Zend_Controller_Action _setParam (string $paramName, mixed $value)
  • string $paramName
  • mixed $value
__call (line 323)

Proxy for undefined methods. Default behavior is to throw an exception on undefined methods, however this function can be overridden to implement magic (dynamic) actions, or provide run-time dispatching.

  • access: public
void __call (string $methodName, array $args)
  • string $methodName
  • array $args

Documentation generated on Thu, 18 Jan 2007 09:52:06 -0800 by phpDocumentor 1.3.1