I’ve something like
<?php
class AccountController extends Zend_Controller_Action
{
public function init()
{
if(!Zend_Auth::getInstance()->hasIdentity()) {
//need to forward to the auth action in another controller,
//instead of dispatching to whatever action it would be dispatched to
}
}
...
I can’t use $this->_forward(“action”) because the auth action is not in the same controller and in the init, forwarding has to be for a action in the same controller. Any ideas?
$request->setModuleName('module')
->setControllerName('controller')
->setActionName('action');
also doesn’t work. I’ve tried to clear the params, but still I’ve got nothing.
Put it in a Front Controller Plugin
You may want to redirect instead of ‘forwarding’, you can use the redirector helper.
Note that it’s the basic usage of the redirector helper, you may also want to use goToRoute() method which allows you to use custom routes.
Here is the signature of the method:
The usage is similar to the view helper
url()