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

Issue Type: Bug Created: 2011-12-05T20:23:09.000+0000 Last Updated: 2012-06-14T21:05:48.000+0000 Status: Resolved Fix version(s): Reporter: david quintard (booradleys) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend\Mvc\Controller

Related issues: Attachments:


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]


Posted by Matthew Weier O'Phinney (matthew) on 2012-01-03T21:55:49.000+0000

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.

Posted by Maks 3w (maks3w) on 2012-06-14T21:05:48.000+0000

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

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.