You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
thrownewInvalidArgumentException(sprintf('Doctrine event listener "%s" must specify the "event" attribute.', $id));
89
90
}
@@ -93,15 +94,19 @@ private function addTaggedListeners(ContainerBuilder $container)
93
94
if (!isset($this->connections[$con])) {
94
95
thrownewRuntimeException(sprintf('The Doctrine connection "%s" referenced in service "%s" does not exist. Available connections names: %s', $con, $id, implode(', ', array_keys($this->connections))));
95
96
}
96
-
97
-
if ($lazy = !empty($tag['lazy'])) {
98
-
$taggedListenerDef->setPublic(true);
99
-
}
97
+
$listenerRefs[$con][$id] = newReference($id);
100
98
101
99
// we add one call per event per service so we have the correct order
Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPassTest.php
0 commit comments