-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Always load Doctrine listeners lazily #27661
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
Comments
Makes sense 👍 See #27675 |
…ServiceLocator (dmaicher) This PR was squashed before being merged into the 4.2-dev branch (closes #27675). Discussion ---------- [DoctrineBridge] always load event listeners lazy via ServiceLocator | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | yes/no | Tests pass? | yes | Fixed tickets | symfony/symfony#27661 | License | MIT | Doc PR | symfony/symfony-docs#9973 As described in symfony/symfony#27661 this PR suggests to always load doctrine event listeners lazily from a service locator instead of the full service container. If we agree to move forward I could tackle the remaining todos: - [x] update UPGRADE.md - [x] documentation PR - [x] tested on real app Commits ------- 130ec0525d [DoctrineBridge] always load event listeners lazy via ServiceLocator
…ServiceLocator (dmaicher) This PR was squashed before being merged into the 4.2-dev branch (closes #27675). Discussion ---------- [DoctrineBridge] always load event listeners lazy via ServiceLocator | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | yes/no | Tests pass? | yes | Fixed tickets | #27661 | License | MIT | Doc PR | symfony/symfony-docs#9973 As described in #27661 this PR suggests to always load doctrine event listeners lazily from a service locator instead of the full service container. If we agree to move forward I could tackle the remaining todos: - [x] update UPGRADE.md - [x] documentation PR - [x] tested on real app Commits ------- 130ec05 [DoctrineBridge] always load event listeners lazy via ServiceLocator
Hi, we just ran into some major problems upgrading to DoctrineBridge 4.2. due to this change. Removing EventListeners by using Best, Hannes |
Description
Currently, Doctrine event listeners are instantiated in order to create the Doctrine event manager. You can fix this by adding a
lazy=true
option to your service (this feature was added 6+ years ago). Could we just always make this lazy? This would solve issues during cache building, where all of the listeners are instantiated.Relevant code:
symfony/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php
Lines 97 to 99 in 8123bb1
Especially if we refactored the ContainerAwareEventManager to accept a service locator (instead of the entire container), this would be an easy win: we wouldn't even need to make the original definitions public anymore (which is the only downside).
The text was updated successfully, but these errors were encountered: