-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DependencyInjection] [ProxyManager] Use lazy-loading ghost object proxies when possible #46458
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13c10d3
to
99d80b0
Compare
stof
reviewed
May 25, 2022
src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_dedup_lazy_proxy.php
Outdated
Show resolved
Hide resolved
8372196
to
d4b62aa
Compare
f361fd0
to
5d34999
Compare
stof
reviewed
May 27, 2022
42d8812
to
1c70a63
Compare
For what it's worth, this PR works like a charm on a real project :) |
1c70a63
to
b23099e
Compare
I updated the PR to keep using a value holder when the proxied class is internal. |
b23099e
to
2547eb0
Compare
2547eb0
to
8d50e2a
Compare
nicolas-grekas
added a commit
that referenced
this pull request
Jun 22, 2022
…zy loading services (nicolas-grekas) This PR was merged into the 6.2 branch. Discussion ---------- [DependencyInjection] Allow using ghost objects for lazy loading services | Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - This PR is a subset of #46458 that contains the needed API changes to allow lazy-proxy dumpers to use ghost objects. The main change of this PR is adding argument `bool &$asGhostObject = null` to LazyProxy's `DumperInterface`. The rest is the consequence of that new capability. The changes on ProxyManager are all minor: refactoring the code to make it more flexible (as proved by #46458) and adding the new argument but not doing anything with it (yet.) Commits ------- 2997693 [DependencyInjection] Allow using ghost objects for lazy loading services
…xies when possible
8d50e2a
to
613dd45
Compare
Closing in favor of #46752 |
nicolas-grekas
added a commit
that referenced
this pull request
Jul 12, 2022
…oxies out of the box (nicolas-grekas) This PR was merged into the 6.2 branch. Discussion ---------- [DependencyInjection] Use lazy-loading ghost object proxies out of the box | Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | Fix #35345 | License | MIT | Doc PR | - This PR builds on #46751. It also replaces #46458. Instead of using ProxyManager to make lazy services actually lazy, using `LazyGhostObjectTrait` from #46751 allows doing so *out of the box* - aka without the need to install any optional dependencies. When a virtual proxy is required (typically when using [the `proxy` tag](#27697)), ProxyManager is still required (and the dep remains optional.) But for most services, using `LazyGhostObjectTrait` just works \o/ Commits ------- 58a1848 [DependencyInjection] Use lazy-loading ghost object proxies out of the box
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR makes proxy-manager-bridge use a ghost object proxy by default.
We keep using a value holder proxy:
When a ghost object is initialized, two code paths are possible:
__construct()
explicitly on the uninitialized object;