Overwrite templates in Resources folder seems not to work
ElectricMaxxx opened this issue · 5 comments
Tried to debug the error in symfony-cmf/seo-bundle#177 There want to implement a test where i needet to overwrite the TwigBundle:Exception:exception_full.html.twig
in a test. So i created a copy in Tests/Resources/app/Resources/TwigBundle/views/Exception/exception.html.twig
which seems to be the right folder. But not for the Symfony cache of the test application. While debugging, i saw that the application tries to render the orignal template in the TwigBundle.
Any ideas for the place to put the templates? Or does the test application does not add my template?
Hmm, that should work I guess. Maybe you want to try debugging the Symfony template loader to find out where it is looking?
You have a hint how that loading (from Cache) is working?
Yould tryu adding a var_dump
or similar to the locate
method of vendor/symfony/symfony/src/Symfony/Component/Config/FileLocator.php
class.
I think loading of the file is to late. debugged into the render method - really deep. And ther i found the point where the TemplateName was computed into the the real template (as a file). There i found that the file was catched from an array called cache
with the templateName as key(s). In that case one template was in the array and that was the orinal one. So i need to find the moment, when the template file is allocated to that array or look what the cache mechanism does in that moment.
think i solved my problem, needed to use the exception_full.html.twig
template instead of the exception.html.twig
.