today, I’ve run into a problem that I don’t understand.
I have a small application with a number of controllers.
Usually all my templates reside in view/foo/bar/action.phtml where foo is my module’s name, bar is the route and action is the method called on the controller with slight modifications.
So, I have templates like member/member/index.phtml or member/password/requests.phtml within my view directory.
But now I get an exception that looks strange to me: Laminas\View\Renderer\PhpRenderer::render: Unable to render template "admin/group/group/list-groups"; resolver could not resolve to
Why do I have group twice in this path?
The configuration does not differ from any other route, but when I start debugging, the ViewModel always contains this as the template path.
So my question ist:
Why (under which circumstances) does this happen and how can I change this behavior?
As I’m not able to understand what’s going on there, it looks somehow erratic to me
It’s the same in all other modules where it works properly.
And yes, the directory with the files is there, too.
I’m just confused why the controller’s name is twice in the generated template path.
Please check the namespace and classname of your controller, maybe you have Admin\Controller\Group\GroupController instead of Admin\Controller\GroupController.
Thanks a lot - that was the hint!
I used namespaces in a DDD-style, so, the GroupController was in the namespace Group, not Controller.
After moving it to the namespace (and directory) Controller, it works perfectly.
Good to know that some principles depend on the namespaces.