-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DependencyInjection] Fix service autowiring inheritance #19643
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's technically a minor BC break: a service whose parent is autowired, would not have been autowired before, but now it would be. But, except for an optional dependency in the constructor, instantiation of that child would have failed, because it would be missing its autowired dependencies. So, the BC break is for child services that have optional, type-hinted constructor args: the container will now try to autowire those, but it didn't before. Still, this is a bug and that's seems like a real edge-case. I think we should fix it. If I'm right, should be update the CHANGELOG or UPGRADE doc? 👍 |
22fd618
to
143c5c1
Compare
CHANGELOG updated, thanks @weaverryan. |
143c5c1
to
04ce15d
Compare
👍 Although i wouldn't treat it as a BC break. Technically it should either be a bugfix or a BC break :) |
@jakzal Let me know if I can do something for that. |
2.8.9 | ||
----- | ||
|
||
* [BC BREAK] fixed inheritance of the `autowire` flag |
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.
Like @jakzal, I think it's more a bug than a a BC break. Anyway, we should either remove the [BC BREAK]
here or merge this PR on master.
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 BC break flag has been removed as you and @jakzal seem to agree for treat it as a bug fix only.
04ce15d
to
c49f056
Compare
----- | ||
|
||
* fixed inheritance of the `autowire` flag | ||
|
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 whole paragraph should be removed as the CHANGELOG is automatically generated.
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.
done
Update Changelog
c49f056
to
fb95bdc
Compare
Thank you @chalasr. |
…chalasr) This PR was merged into the 2.8 branch. Discussion ---------- [DependencyInjection] Fix service autowiring inheritance | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #19615 | License | MIT | Doc PR | n/a This makes services inherit the `autowire` attribute from their parent and fix the ability to override it from the child. Fixed cases: - Simple inheritance ```yaml parent: class: Foo abstract: true autowire: true child: class: Foo ``` - Set in the child (only) ```yaml parent: class: Foo abstract: true child: class: Foo autowire: true ``` - Set in the parent, changed in the child ```yaml parent: class: Foo abstract: true autowire: true child: class: Foo autowire: false ``` Commits ------- fb95bdc [DIC] Fix service autowiring inheritance
This makes services inherit the
autowire
attribute from their parent and fix the ability to override it from the child.Fixed cases: