From 8cdbdcb1c9aaf1920cebcf5b6399d7c77261ea79 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 20 Jan 2021 13:35:43 +0100 Subject: [PATCH] do not fail when MercureBundle is not installed --- .../DependencyInjection/FrameworkExtension.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 7da70be941..f287c8b5f0 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -2257,13 +2257,11 @@ class FrameworkExtension extends Extension } } - if (class_exists(MercureTransportFactory::class)) { - if (!class_exists(MercureBundle::class)) { - throw new \LogicException('The MercureBundle is not registered in your application. Try running "composer require symfony/mercure-bundle".'); - } - + if (class_exists(MercureTransportFactory::class) && class_exists(MercureBundle::class)) { $container->getDefinition($classToServices[MercureTransportFactory::class]) ->replaceArgument('$publisherLocator', new ServiceLocatorArgument(new TaggedIteratorArgument('mercure.publisher', null, null, true))); + } elseif (class_exists(MercureTransportFactory::class)) { + $container->removeDefinition($classToServices[MercureTransportFactory::class]); } if (isset($config['admin_recipients'])) {