Skip to content

The scope is not inherited from the parent service #4620

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

Closed
stof opened this issue Jun 20, 2012 · 3 comments
Closed

The scope is not inherited from the parent service #4620

stof opened this issue Jun 20, 2012 · 3 comments

Comments

@stof
Copy link
Member

stof commented Jun 20, 2012

when defining a service with a DefinitionDecorator (parent="acme_demo.foo" in XML), the scope is not inherited, which causes issues if the parent definition defines the scope as request and a dependency on the request. Currently, the dependency will be inherited but not the scope, causing a ScopeWideningInjectionException if you don't redeclare the request scope on the child service.
/cc @schmittjoh

@schmittjoh
Copy link
Contributor

Yes, this is intended behavior. Scopes must be explicitly declared for all services.

@stof
Copy link
Member Author

stof commented Jun 21, 2012

why forcing to redeclare it explicitly whereas all other properties are inherited ?

@schmittjoh
Copy link
Contributor

There are a few special properties which are not inherited, see the pass that does it.

Anyway, changing it would create a BC break that we do not really need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants