Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[RFC] Introduce new template namespaces for bundles #11051

@javiereguiluz

Description

@javiereguiluz

(this issue is part of the "DX" ("Developer eXperience") initiative introduced by Symfony project)

On the symfony-docs repository there is a very long discussion about the new template naming syntax.

In short, some people think that the old syntax has inconsistencies in cases like the following:

  • Resource: @AcmeBlogBundle/Resources/views/Default/common/template4.html.twig
  • Template: AcmeBlogBundle : Default : common / template4.html.twig
  • Also valid: AcmeBlogBundle : Default / common : template4.html.twig

Using the new namespaced Twig syntax, the template name would always be:

@AcmeBlog/Default/common/template4.html.twig

Removing the Resources/views/ part is very common and easy to understand. But removing the Bundle suffix is really strange and inconsistent with the rest of Symfony.

This problem is introduced in lines 136-138 of TwigBundle/DependencyInjection/TwigExtension.php file.

Summarized Proposals

Deprecate the current behavior (0) and choose one of the following to implement and recommend:

Prop Template Notes
0 AcmeBlogBundle:Default:index.html.twig current
1 @AcmeBlogBundle/Default/index.html.twig Assumed Resources/views
2 @AcmeBlogBundle:Default/index.html.twig Assumed Resources/views
3 AcmeBlogBundle:Default/index.html.twig Assumed Resources/views
4 @AcmeBlogBundle:views/Default/index.html.twig Assumed Resources, could also be used consistent with routing imports
5 AcmeBlogBundle:views/Default/index.html.twig Assumed Resources
6 view@AcmeDemoBundle/Default/index.html.twig we might also have public@, config@ that could be used elsewhere

Metadata

Metadata

Assignees

No one assigned

    Labels

    DXDX = Developer eXperience (anything that improves the experience of using Symfony)FrameworkBundleRFCRFC = Request For Comments (proposals about features that you want to be discussed)

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions