zf2 resolve module view path
dependency-injection, model-view-controller, php, zend-framework2
Solution
Note that questions like this help shape the direction of the stable framework. :)
One idea I've been toying with is to use the module as part of the view script resolution. Right now, the default used is "/"; my proposal is to use "//", as this would help prevent naming conflicts between modules; it also makes it much simpler to understand exactly what view script you are overriding if you use template maps.
You can use this approach today, but it will require manually setting the template on the view models you return from your controllers.
Problem
Starting from the skeleton application using beta3 how would you resolve the view path for a new module called Foo? I have added below to the di config and now both modules action's render Foo's views. ``` 'Zend\View\Resolver\TemplatePathStack' => array( 'parameters' => array( 'paths' => array( 'foo' => __DIR__ . '/../view', ), ), ), ``` I would expect `Application\Controller\IndexController::indexAction()` to render the views in Application and for `Foo\Controller\IndexController::indexAction()` to render Foo's views.