-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Closed
Labels
RFCRFC = Request For Comments (proposals about features that you want to be discussed)RFC = Request For Comments (proposals about features that you want to be discussed)TwigBundle
Description
Context
This method of the TwigBundle removes the Bundle
suffix before adding them as Twig paths. So in your templates:
{# it works #}
{% extends '@App/Default/index.html.twig' %}
{# it doesn't work #}
{% extends '@AppBundle/Default/index.html.twig' %}
Problem
- In the particular case of the AppBundle, the
@App/...
notation may be confusing because you may not be sure if it refers toapp/...
orsrc/AppBundle/...
- This behavior is not consistent in Symfony (everywhere else you must add the
Bundle
suffix):-
For example, to load resources in routing:
# it works resource: "@AppBundle/Controller/" # it doesn't work resource: "@App/Controller/"
-
The old "bundle notation" also requires the
Bundle
prefix:{# it works #} {{ render(controller('AppBundle:Article:recentArticles')) }} {# it doesn't work #} {{ render(controller('App:Article:recentArticles')) }}
-
In summary, the automagical removal of the Bundle
suffix makes developers think: which is the right notation for this? Should I add the Bundle
suffix or not?
Proposal
- I propose to remove this feature and always use the
Bundle
suffix everywhere. - Although you now would type 6 more characters, I think it's worth it to avoid confusion and improve consistency.
- If accepted, first I'd add both paths (with and without
Bundle
) but deprecate the Twig paths without theBundle
suffix. Then I'd remove the suffix-less paths in Symfony 4.0.
Thoughts?
Koc, rybakit, linaori, tifabien, yceruto and 13 more
Metadata
Metadata
Assignees
Labels
RFCRFC = Request For Comments (proposals about features that you want to be discussed)RFC = Request For Comments (proposals about features that you want to be discussed)TwigBundle