From 321e1754438221b6e25c90b1c1c910ba0fc0bebe Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 19 Sep 2018 10:40:38 +0200 Subject: [PATCH] Fix handling of lazy entity listeners --- DependencyInjection/Compiler/EntityListenerPass.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DependencyInjection/Compiler/EntityListenerPass.php b/DependencyInjection/Compiler/EntityListenerPass.php index f25538d52..04b6f3d17 100644 --- a/DependencyInjection/Compiler/EntityListenerPass.php +++ b/DependencyInjection/Compiler/EntityListenerPass.php @@ -52,9 +52,9 @@ public function process(ContainerBuilder $container) $this->attachToListener($container, $name, $id, $attributes); } - if (isset($attributes['lazy']) && $attributes['lazy']) { - $listener = $container->findDefinition($id); + $listener = $container->findDefinition($id); + if ($listener->isLazy() || !empty($attributes['lazy'])) { if ($listener->isAbstract()) { throw new InvalidArgumentException(sprintf('The service "%s" must not be abstract as this entity listener is lazy-loaded.', $id)); }