Issues

ZF2-342: Forward plugin to another controller throws a routing error

Description

beta4 official package. Using the forward plugin I attempt to dispatch an action on a different controller:

 public function someAction() {
   return $this->forward()->dispatch('SomeOtherController', array('action' => 'anotheraction', 'param' => $value));
 }

The error message returned is:


 Missing route matches; unsure how to retrieve action

I solved this issue locally by adding the following line to the Forward plugin:


 $controller->setEvent($event);

to line 48 on the Forward.php file

It looks like the new controller was not registering the new event created for the dispatch. Once I added the line, it behaves as expected.

Comments

I ran into a similar problem in beta4, but using the latest version of the forward plugin from the master branch in Git resolved the issue. I believe the event-related changes in revision 14b1343c0ad739e652b1c548a71df6307ed9f376 fixed the problem.