hi there,

I'm using $this->_forward() in a controller method to forward the request onto a login page, this can't be done that easily in pre- dispatch since different methods have different requirements for ACL and we have a rather complex custom route system going on (part of which happens in specific controllers). At present we're not using Zend ACL.

It seems the default behaviour of _forward() is to continue processing the current method's code, and then forward to the new controller/ action. So if multiple forwards exist in that method's code, only the last one actually works.

Is this correct? I had presumed _forward() would forward to the new controller/action and exit the code at that specific point. Is this possible? Or do I have to just return from the method at that point in the code? I.e.

  $this->_forward("index", "login");
  return;

Further to this, if the above is the recommended way to forward and quit the current method then this of course becomes problematic if I abstracted the login check. I.e. if I called a function to do something like:

  $this->checkLogin();

And the function checkLogin() did the necessary ACL check and also included the forward() - to avoid DRY.

comments appreciated!
Simon

Reply via email to