Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add warning about removed services#14819

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@alexislefebvre
Copy link
Contributor

@alexislefebvrealexislefebvre commentedJan 11, 2021
edited
Loading

I was confused by the fact that the documentation explains:

Finally, for the most rare edge-cases, Symfony includes a special container which provides access to all services, public and private. This special container is a service that can be get via the normal container

and the fact that the special container doesn't give access to the removed service.

So I added a tip in the documentation, taking inspiration from a Symfony article:

Keep in mind that, because of how Symfony's service container work, unused services are removed from the container. This means that if you have a private service not used by any other service, Symfony will remove it and you won't be able to get it as explained in this article. The solution is to define the service as public explicitly so Symfony doesn't remove it.

Source:https://symfony.com/blog/new-in-symfony-4-1-simpler-service-testing

This is also consistent with the error message from Symfony:https://github.com/symfony/symfony/blob/3ffe5573e9dd045e157c6f17358c700fceae3feb/src/Symfony/Component/DependencyInjection/Container.php#L275

See also#12647 andsymfony/symfony#30104

@carsonbotcarsonbot added this to the4.4 milestoneJan 11, 2021
@alexislefebvrealexislefebvre changed the titleAdd tip about removed servicesAdd warning about removed servicesJan 11, 2021
@javiereguiluzjaviereguiluzforce-pushed theadd-tip-about-removed-services branch from9bd3b60 toe6a6c33CompareJanuary 15, 2021 16:06
@javiereguiluzjaviereguiluz merged commitc9bad24 intosymfony:4.4Jan 15, 2021
@javiereguiluz
Copy link
Member

Thank you Alexis!

alexislefebvre reacted with rocket emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@OskarStarkOskarStarkOskarStark approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

4.4

Development

Successfully merging this pull request may close these issues.

4 participants

@alexislefebvre@javiereguiluz@OskarStark@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp