Invocation parameters are used to store common data inside the Front Controller. This data is passed into the Action Controller, Router, and Dispatcher for all requests.Invocation parameters can be used to pass an object created during the bootstrap to the Controller Action.
In bootstrap:
1 2 3 | $front = Zend_Controller_Front::getInstance(); $param = new SomeClass(); $front->setParam('myparam',$param); |
We can then retrieve this from one of our controllers using the getInvokeArg() method:
1 | $myparam = $this->getInvokeArg('myparam'); |
The parameters can be objects, arrays or plain variables.
The Front Controller has the following methods for handling invocation parameters:
setParam(String $name, Mixed $value): Set an invocation parameter
setParams(Array $params): Set multiple invocation parameters
getParam(String $name): Retrieve an invocation parameter
getParams(): Retrieve all invocation parameters
clearParams(String|Array|Null $name): Clear a single or multiple or all invocation parameters