Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Closed
Uh oh!
There was an error while loading.Please reload this page.
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 to99d80b0Comparesrc/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_dedup_lazy_proxy.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
8372196 tod4b62aaComparef361fd0 to5d34999CompareUh oh!
There was an error while loading.Please reload this page.
42d8812 to1c70a63CompareFor what it's worth, this PR works like a charm on a real project :) |
I updated the PR to keep using a value holder when the proxied class is internal. |
nicolas-grekas added a commit that referenced this pull requestJun 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
Closing in favor of#46752 |
nicolas-grekas added a commit that referenced this pull requestJul 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 freeto 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.
Uh oh!
There was an error while loading.Please reload this page.
This PR makes proxy-manager-bridge use aghost object proxy by default.
We keep using avalue holder proxy:
When a ghost object is initialized, two code paths are possible:
__construct()explicitly on the uninitialized object;