Skip to content
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

[DependencyInjection] fixed definition loosing property shared when decorated by a parent definition #16926

Closed
wants to merge 2 commits into from

Conversation

wahler
Copy link

@wahler wahler commented Dec 9, 2015

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets
License MIT
Doc PR

While upgrading my applications from 2.7 and 2.8 I found out that the attribute "shared" gets lost when a parent is configured. I wrote a Test to confirm my assumption and added a bugfix


$container
->setDefinition('child', new DefinitionDecorator('parent'))
->setShared(false)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO you should put this setShared(false) in the definition of the parent service in order to test if we pass the same shared value to their childrens.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dosten the shared flag is always taken from the child (same than the scope in 2.x, as this is the replacement for the scope)

@ivarb
Copy link

ivarb commented Dec 16, 2015

Also noticed this bug while upgrading from 2.7 to 2.8. Would very much appreciate this patch in 2.8 👍

@nicolas-grekas
Copy link
Member

👍
Status: reviewed

@fabpot
Copy link
Member

fabpot commented Dec 18, 2015

Thank you @wahler.

fabpot added a commit that referenced this pull request Dec 18, 2015
…ared when decorated by a parent definition (wahler)

This PR was squashed before being merged into the 2.8 branch (closes #16926).

Discussion
----------

[DependencyInjection] fixed definition loosing property shared when decorated by a parent definition

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

While upgrading my applications from 2.7 and 2.8 I found out that the attribute "shared" gets lost when a parent is configured. I wrote a Test to confirm my assumption and added a bugfix

Commits
-------

d3a4a77 [DependencyInjection] fixed definition loosing property shared when decorated by a parent definition
@fabpot fabpot closed this Dec 18, 2015
This was referenced Dec 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants