minor #39903 [FrameworkBundle] do not fail when MercureBundle is not installed (xabbuh)

This PR was merged into the 5.3-dev branch.

Discussion
----------

[FrameworkBundle] do not fail when MercureBundle is not installed

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

Commits
-------

8cdbdcb1c9 do not fail when MercureBundle is not installed
This commit is contained in:
Robin Chalas 2021-01-20 14:04:20 +01:00
commit 6b9fa0be67

View File

@ -2257,13 +2257,11 @@ class FrameworkExtension extends Extension
} }
} }
if (class_exists(MercureTransportFactory::class)) { if (class_exists(MercureTransportFactory::class) && class_exists(MercureBundle::class)) {
if (!class_exists(MercureBundle::class)) {
throw new \LogicException('The MercureBundle is not registered in your application. Try running "composer require symfony/mercure-bundle".');
}
$container->getDefinition($classToServices[MercureTransportFactory::class]) $container->getDefinition($classToServices[MercureTransportFactory::class])
->replaceArgument('$publisherLocator', new ServiceLocatorArgument(new TaggedIteratorArgument('mercure.publisher', null, null, true))); ->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'])) { if (isset($config['admin_recipients'])) {