A number of objects and variables are registered with the object, and each has accessor methods.
Request Object:
getRequest()may be used to retrieve the request object used to call the action.-
Response Object:
getResponse()may be used to retrieve the response object aggregating the final response. Some typical calls might look like:<?php
$this->getResponse()->setHeader('Content-Type', 'text/xml');
$this->getResponse()->appendBody($content); Invocation Arguments: the front controller may push parameters into the router, dispatcher, and action controller. To retrieve these, use
getInvokeArg($key); alternatively, fetch the entire list usinggetInvokeArgs().-
Request parameters: The request object aggregates request parameters, such as any
_GETor_POSTparameters, or user parameters specified in the URL's path information. To retrieve these, use_getParam($key)or_getAllParams(). You may also set request parameters using_setParam(); this is useful when forwarding to additional actions.To test whether or not a parameter exists (useful for logical branching), use
_hasParam($key).Note
_getParam()may take an optional second argument containing a default value to use if the parameter is not set or is empty. Using it eliminates the need to call_hasParam()prior to retrieving a value:<?php
// Use default value of 1 if id is not set
$id = $this->_getParam('id', 1);
// Instead of:
if ($this->_hasParam('id') {
$id = $this->_getParam('id');
} else {
$id = 1;
}




