Trying to modify the template auto routing from controller


#1

Hello!

So I created a bundle but the default directory structure does not satisfy me. I want to change it but still want to use Pimcore auto detection (since static routes do not provide a way to force a template and $this->render in a controller works but does not overrides Pimcore’s default behavior leading to fatal exception).

Currently, within a bundle Pimcore autoloads like :

src/MyBundle/Resources/views/Controller/action.html.php

I want it to be src/MyBundle/Resources/views/documents/Controller/action.html.php because there are multiple other files stored in views which are unrelated to controllers (such as partials).

At first I tried to store them in Resources/ but it doesn’t seem possible to render a file from a folder higher than /views so I switched to creating subfolders. Now I have a static route that I need to use but it does not work because it always tries to render a file that does not exist even using the default Symfony $this->render() and $response->send() from within the controller.

I searched in the Pimcore documentation and the Symfony documentation and couldn’t find anything related to this specific issue. Could you please help me?

Thanks!