2009年9月14日星期一

Re: [fw-mvc] _forward()

Hi Neil,

are the controllers in separate modules ?
If so you'll have to specify the module also

public function indexAction()
    {
        ...
        $this->_forward('action', 'controller', 'module');
    }

I just tested on my end and it works as expected.

Martin Carpentier


On Mon, Sep 14, 2009 at 13:05, Neil Garb <neil.garb@gmail.com> wrote:
Hi all

If I _forward() to another controller / action, does the current controller need to have an action by the same name?

I'm getting a "not trapped by __call" exception in the following situation:

class OneController extends Zend_Controller_Action
{
 public function indexAction()
 {
  echo 'OneController::indexAction()';
  $this->_forward('view', 'two');
 }
}

class TwoController extends Zend_Controller_Action
{
 public function viewAction()
 {
  echo 'TwoController::viewAction()';
 }
}

If I add viewAction() to OneController, it does the redirect fine.

Using ZF 1.9.2.

- Neil

没有评论: