Issue Type: Bug Created: 2012-06-07T06:24:18.000+0000 Last Updated: 2012-10-08T20:15:13.000+0000 Status: Closed Fix version(s): Reporter: Yonni Mendes (yonman) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend\Mvc
Related issues: Attachments:
Using beta4. After using the forward plugin in a controller action and then returning a different view model causes a resolver error:
<pre class="highlight">
class IndexController extends ActionController
{
public function indexAction() {
$viewModel = $this->forward()->dispatch('SomeOtherController', array(...));
.
.
.
return new ViewModel(array(...));
}
}
The above snippet causes the InjectViewModel::injectViewModel triggered by the 'render' event to introduce a 2nd view model under the layout, which calls to a mangled view script made of the original action's name and the forwarded view script's directory name... which doesn't exist and so fails.
<pre class="literal">
PHP Fatal error: Uncaught exception 'Zend\View\Exception\RuntimeException' with message 'Zend\View\Renderer\PhpRenderer::render: Unable to render template "servers/web-api/index"; resolver could not resolve to a file
Note the path above - servers is the namespace, web-api is the name of the "other controller" and index is the action for the "current controller".
Work around - Return the forward's output view model. This seems to avoid the issue some-why.
<pre class="highlight">
class IndexController extends ActionController
{
public function indexAction() {
$viewModel = $this->forward()->dispatch('SomeOtherController', array(...));
.
.
.
return $viewModel;
}
}
Posted by Ralph Schindler (ralph) on 2012-10-08T20:15:13.000+0000
This issue has been closed on Jira and moved to GitHub for issue tracking. To continue following the resolution of this issues, please visit: https://github.com/zendframework/zf2/issues/2490