8000 [DependencyInjection] Bugs with private services by alexandresalome · Pull Request #2586 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[DependencyInjection] Bugs with private services #2586

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
wants to merge 2 commits into from
Closed

[DependencyInjection] Bugs with private services #2586

wants to merge 2 commits into from

Conversation

alexandresalome
Copy link

I've started developing new tests in this PR, because I faced the problem today concerning some precise cases. The best way to understand them is probably to look at the pull request.

I will investigate this point more in detail, but I'm not yet confortable with the container compiler. Please tell me if I'm going in a wrong direction.

@stof
Copy link
Member
stof commented Nov 8, 2011

Private services are not meant to be available at runtime. But when they are used by several instance, they cannot be inlined when optimizing the container. private does not mean that the service will always be removed when optimizing but that the can be inlined and removed

@alexandresalome
Copy link
Author

The name public should mean "public": service is accessible, I can call ->get('name') on it.

Just a discussion for the moment, but I see some inconsistence, as coded in the tests.

@stof
Copy link
Member
stof commented Nov 8, 2011

@alexandresalome public="false" means that you cannot retrieve the service at runtime through ->get('a') because the compiler may have removed it when optimizing the container. But a service used several times cannot be removed during the optimization (inlining it would mean that you don't share it anymore).

Handling the non-inlined private services separately would require adding lots of logic as the dependencies should be retrieved differently according to their visibility. This would make the code harder to maintain, without adding a real value IMO.

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

Successfully merging this pull request may close these issues.

3 participants
0