Use namespaced template paths for Symfony #20
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This changes the template reference resolution for Symfony controller actions to use the newer namespaced template paths vs. the older colon-separated syntax.
Old version:
FooBundle:Folder:Subfolder:template.html.twig
Namespaced Version:
@Foo/Folder/Subfolder/template.html.twig
Starting with Symfony 5 the old syntax does not seem to work in all cases anymore. In Symfony 4 there seem to be resolution issues with this when not using the now deprecated framework templating integration (
framework.templating
config) to enable Twig. Unfortunately, I couldn't quite pinpoint what change exactly drops the support for the old syntax but the newer syntax has been suggested in the official Symfony docs for a couple of major versions now, so I feel like this change is generally beneficial.These namespaced paths are available since before Symfony 4 so there should not be any compatibility issues with the currently supported versions.