-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Explained the locateResource() method of HttpKernel #7909
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
bundles/best_practices.rst
Outdated
files, etc.), don't use physical paths (e.g. ``__DIR__/config/services.xml``) | ||
but logical paths (e.g. ``@AppBundle/Resources/config/services.xml``). | ||
|
||
The logical paths are required beucase of the bundle overriding mechanism that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because
bundles/best_practices.rst
Outdated
Resources | ||
--------- | ||
|
||
If the bundle references any resources (config files, templates, translation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The notation explained here does not work for Twig templates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid I don't understand your comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For Twig templates the namespace would be @App
instead of @AppBundle
. And furthermore, you would leave out the Resources/views
portion of the template path (because Twig namespaces are not handled by the kernel resource locater but are a core feature of Twig itself).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've reworded this. I truly dislike that the logical path of templates is different than for the rest of resources. I understand that "old Symfony" used bundles everywhere and @App/Default/index.html.twig
was more convenient than @AppBundle/Resources/views/Default/index.html.twig
.
However, for Symfony 4 / Flex, which removes the concept of bundles for your own code, I think we should remove this difference and use the same syntax for everything.
lets you override any resource/file of any bundle. See :ref:`http-kernel-resource-locator` | ||
for more details about transforming physical paths into logical paths. | ||
|
||
Beware that templates use a simplified version of the logical path showed above. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shown
for more details about transforming physical paths into logical paths. | ||
|
||
Beware that templates use a simplified version of the logical path showed above. | ||
For example, a ``index.html.twig`` template located in the ``Resources/views/Default/`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
an
Thank you Javier. |
…ereguiluz) This PR was squashed before being merged into the 2.7 branch (closes #7909). Discussion ---------- Explained the locateResource() method of HttpKernel This fixes #4065 and replaces #7479, which didn't explain the method inside the HttpKernel component docs. Commits ------- b46ff01 Explained the locateResource() method of HttpKernel
* 2.7: [#7907] add some use statements Updating Doctrine syntax for getRepository method Updating doctrine class use [#7909] fix some typos Explained the locateResource() method of HttpKernel Reworded the note about dump() not being available in prod Symfony Installer Instructions for Windows Typo Fixing a typo in the Final Thoughts section Stop recommending the use of "doctrine:generate:entities" Added a help note about translating routes Use a safer code sample for Twig best practices Use the Twig namespaced syntax for all templates
* 2.8: [#7907] add some use statements Updating Doctrine syntax for getRepository method Reworded the tip about property_info and Symfony framework remove useless space Add information for enable property_info service Updating doctrine class use [#7909] fix some typos Explained the locateResource() method of HttpKernel Reworded the note about dump() not being available in prod Symfony Installer Instructions for Windows Typo Fixing a typo in the Final Thoughts section Stop recommending the use of "doctrine:generate:entities" Added a help note about translating routes Use a safer code sample for Twig best practices Use the Twig namespaced syntax for all templates Updated the screenshot of deprecation messages
* 3.2: [#7907] add some use statements Updating Doctrine syntax for getRepository method Reworded the tip about property_info and Symfony framework remove useless space Add information for enable property_info service Updating doctrine class use Fixed the parse() method in the ExpressionLanguage AST examples [#7909] fix some typos Explained the locateResource() method of HttpKernel Reworded the note about dump() not being available in prod Symfony Installer Instructions for Windows Typo Fixing a typo in the Final Thoughts section Stop recommending the use of "doctrine:generate:entities" Use "null" so the lock is named automatically Added a help note about translating routes Use a safer code sample for Twig best practices Use the Twig namespaced syntax for all templates Updated the screenshot of deprecation messages Update lockable_trait.rst
* 3.3: (36 commits) [#7907] add some use statements Updating Doctrine syntax for getRepository method Reworded the tip about property_info and Symfony framework remove useless space Add information for enable property_info service Updating doctrine class use Fixed the parse() method in the ExpressionLanguage AST examples [#7909] fix some typos Explained the locateResource() method of HttpKernel Reworded the note about dump() not being available in prod Symfony Installer Instructions for Windows Updated the screenshot of exceptions in dev environment Typo Fixing a typo in the Final Thoughts section Stop recommending the use of "doctrine:generate:entities" Use "null" so the lock is named automatically incorrect session short description Use of Setters and Getters Small mistype edits Changed text how to get button label ...
* 3.4: (23 commits) [#7907] add some use statements Updating Doctrine syntax for getRepository method Reworded the tip about property_info and Symfony framework remove useless space Add information for enable property_info service Updating doctrine class use Fixed the parse() method in the ExpressionLanguage AST examples [#7909] fix some typos Explained the locateResource() method of HttpKernel Reworded the note about dump() not being available in prod Symfony Installer Instructions for Windows Updated the screenshot of exceptions in dev environment Typo Fixing a typo in the Final Thoughts section Stop recommending the use of "doctrine:generate:entities" Use "null" so the lock is named automatically Added a help note about translating routes Use a safer code sample for Twig best practices Use the Twig namespaced syntax for all templates Updated the screenshot of deprecation messages ...
This fixes #4065 and replaces #7479, which didn't explain the method inside the HttpKernel component docs.