-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpKernel] Deprecate bundle inheritance #24160
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
fabpot
commented
Sep 11, 2017
•
edited
Loading
edited
Q | A |
---|---|
Branch? | 3.4 |
Bug fix? | no |
New feature? | yes |
BC breaks? | no |
Deprecations? | yes |
Tests pass? | yes |
Fixed tickets | #24048 |
License | MIT |
Doc PR | symfony/symfony-docs#8389 |
b02a36d
to
cad7f61
Compare
cad7f61
to
5f20b5c
Compare
5f20b5c
to
aa56c12
Compare
@@ -206,6 +206,10 @@ public function getBundles() | |||
*/ | |||
public function getBundle($name, $first = true) | |||
{ | |||
if (false === $first) { | |||
@trigger_error(sprintf('Passing "false" as the second argument to %s() is deprecated as of 3.4 and will be removed in 4.0.', __METHOD_), E_USER_DEPRECATED); |
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.
Typo, __METHOD_
should be __METHOD__
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.
fixed
aa56c12
to
4f2beb9
Compare
@@ -206,6 +206,10 @@ public function getBundles() | |||
*/ | |||
public function getBundle($name, $first = true) | |||
{ | |||
if (false === $first) { |
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.
at least locateResource
is calling it with false.. should we get rid of $first there too? I believe it serves the same purpose.
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.
Correct, fixed
546a76f
to
8fb7938
Compare
8fb7938
to
9bb10fd
Compare
@@ -204,8 +204,12 @@ public function getBundles() | |||
/** | |||
* {@inheritdoc} | |||
*/ | |||
public function getBundle($name, $first = true) | |||
public function getBundle($name, $first = true, $noDeprecation = false) |
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.
signature change should be removed, func_get_arg
should be used instead.
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.
fixed
@@ -56,6 +56,8 @@ public function getContainerExtension(); | |||
* bundle. | |||
* | |||
* @return string The Bundle name it overrides or null if no parent | |||
* | |||
* @deprecated This method is deprecated as of 3.4 and will be removed in 4.0. |
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.
Do we need to drop the final dot here according to the latest CS changes?
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.
Most @deprecated tags have a dot at the end currently. As this is a sentence, I think that's the way it should be.
Should we also deprecate |
d73a911
to
94707d2
Compare
@chalasr Not sure it makes sense. This method is mainly called by Symfony itself, and if a bundle defines a parent, the message won't be displayed. So, it seems to me better to not add this. |
RFR |
94707d2
to
89893c1
Compare
This PR was squashed before being merged into the 3.4 branch (closes #24160). Discussion ---------- [HttpKernel] Deprecate bundle inheritance | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | #24048 | License | MIT | Doc PR | symfony/symfony-docs#8389 Commits ------- 89893c1 [HttpKernel] deprecated bundle inheritance ee9f4c3 fixed CS
This PR was merged into the 4.0-dev branch. Discussion ---------- [HttpKernel] Remove bundle inheritance | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | yes | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a Blocked by #24160 Commits ------- a8a0a21 [HttpKernel] removed bundle inheritance
…s (yceruto) This PR was merged into the 3.4 branch. Discussion ---------- [TwigBundle] Improve the overriding of bundle templates | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #17557 | License | MIT | Doc PR | - ### [Overriding a Template that also extends itself](https://twig.symfony.com/doc/2.x/recipes.html#overriding-a-template-that-also-extends-itself) Now that bundles inheritance is deprecated and removed (#24160, #24161), I'm wondering if we can solve this old issue defining an exclusive namespace only for root bundles in `3.4` just bundles in `4.0`: ```yaml twig: paths: # adding paths behind the scene into TwigExtension app/Resources/FooBundle/views: Foo vendor/acme/foo-bundle/Resources/views: Foo vendor/acme/foo-bundle/Resources/views: !Foo # exclusive ``` Thus, one can decide when use the exclusive namespace to avoid the issue and then [we could to say also](http://symfony.com/doc/current/templating/overriding.html): > To override the bundle template partially (which contains `block`) creates a new `index.html.twig` template in `app/Resources/AcmeBlogBundle/views/Blog/index.html.twig` and extends from `@!AcmeBlogBundle/Blog/index.html.twig` to customize the bundle template: ```twig {# app/Resources/FooBundle/views/layout.html.twig #} {# this does not work: circular reference to itself #} {% extends '@Foo/layout.html.twig' %} {# this will work: load bundle layout template #} {% extends '@!Foo/layout.html.twig' %} {% block title 'New title' %} ``` I hear other suggestions about the excluse namespace. We will need to update http://symfony.com/doc/current/templating.html#referencing-templates-in-a-bundle too to add this convention. WDYT? Commits ------- 0a658c6 Add exclusive Twig namespace for bundles path