{"action":"opened","issue":{"url":"https://api.github.com/repos/symfony/symfony/issues/27661","repository_url":"https://api.github.com/repos/symfony/symfony","labels_url":"https://api.github.com/repos/symfony/symfony/issues/27661/labels{/name}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/27661/comments","events_url":"https://api.github.com/repos/symfony/symfony/issues/27661/events","html_url":"https://github.com/symfony/symfony/issues/27661","id":334214560,"node_id":"MDU6SXNzdWUzMzQyMTQ1NjA=","number":27661,"title":"Always load Doctrine listeners lazily","user":{"login":"weaverryan","id":121003,"node_id":"MDQ6VXNlcjEyMTAwMw==","avatar_url":"https://avatars1.githubusercontent.com/u/121003?v=4","gravatar_id":"","url":"https://api.github.com/users/weaverryan","html_url":"https://github.com/weaverryan","followers_url":"https://api.github.com/users/weaverryan/followers","following_url":"https://api.github.com/users/weaverryan/following{/other_user}","gists_url":"https://api.github.com/users/weaverryan/gists{/gist_id}","starred_url":"https://api.github.com/users/weaverryan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weaverryan/subscriptions","organizations_url":"https://api.github.com/users/weaverryan/orgs","repos_url":"https://api.github.com/users/weaverryan/repos","events_url":"https://api.github.com/users/weaverryan/events{/privacy}","received_events_url":"https://api.github.com/users/weaverryan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-20T19:18:24Z","updated_at":"2018-06-20T19:18:24Z","closed_at":null,"author_association":"MEMBER","body":"**Description**  \r\nCurrently, 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.\r\n\r\nRelevant code: https://github.com/symfony/symfony/blob/8123bb102b2ad13f2b3f9f364f732f5590d42046/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php#L97-L99\r\n\r\nEspecially if we refactored the [ContainerAwareEventManager](https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php) 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)."}}
{"actor":{"display_login":"weaverryan"}}