The action controller is not directly accessible directly from the front controller plugin. This is the dispatcher that instantiates the controller object, and it does not seem to save it anywhere.
However, the controller is accessible from any registered action assistants. Since action assistants have a hook preDispatch, you can do your injection there.
, library/My/Controller/Helper/Inject.php:
class My_Controller_Helper_Inject extends Zend_Controller_Action_Helper_Abstract
{
public function preDispatch()
{
$controller = $this->getActionController();
$controller->myParamName = 'My param value';
}
}
application/Bootstrap.php:
protected function _initControllerInject()
{
Zend_Controller_Action_HelperBroker::addHelper(
new My_Controller_Helper_Inject()
);
}
, , My_ configs/application.ini:
autoloaderNamespaces[] = "My_"
:
public function myAction()
{
var_dump($this->myParamName);
}
: preDispatch(), , , forward().