ZF2-111: the forward() plugin is not updating the RouteMatch with the controller name.

Description

Hi there, I'm using forward plugin like this: $result = $this->forward()->dispatch('another-controller', array('action' => 'anotheraction')); But i got the following error: Script "index/anotheraction.phtml" not found in path (my script view is here: another-controller/anotheraction.phtml)

Moreover when i disable layout in 'anotheraction', layout is also disabled is my 'mainaction'

code from \Application\View\Listener::renderLayout(): [code] ... $layout = $this->view->render($this->layout, $vars); if($this->view->layout()->isEnabled()) { $response->setContent($layout); } else { $response->setContent($vars['content']);
} ... [code]

Comments

This is a problem of scope. When you call forward(), you end up creating a new RouteMatch which is passed on to the new controller. However, when execution is returned to the originating controller, the original RouteMatch object is used. Since the view listener is listening on the Application::dispatch event, this means that it looks only at the original RouteMatch.

We're hoping to solve this soon as we're planning to attack the view layer in an upcoming milestone.

This issue is now obsolete because the code implied has been refactored.