Skip to content

Commit

Permalink
minor #53156 [FrameworkBundle] don't fail when optional dependencies …
Browse files Browse the repository at this point in the history
…are not present (xabbuh)

This PR was merged into the 5.4 branch.

Discussion
----------

[FrameworkBundle] don't fail when optional dependencies are not present

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        |
| License       | MIT

Commits
-------

123101f don't fail when optional dependencies are not present
  • Loading branch information
xabbuh committed Dec 21, 2023
2 parents 2d8a41a + 123101f commit 50606d3
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2595,8 +2595,8 @@ private function registerNotifierConfiguration(array $config, ContainerBuilder $
if (ContainerBuilder::willBeAvailable('symfony/mercure-notifier', MercureTransportFactory::class, $parentPackages, true) && ContainerBuilder::willBeAvailable('symfony/mercure-bundle', MercureBundle::class, $parentPackages, true) && \in_array(MercureBundle::class, $container->getParameter('kernel.bundles'), true)) {
$container->getDefinition($classToServices[MercureTransportFactory::class])
->replaceArgument('$registry', new Reference(HubRegistry::class))
->replaceArgument('$client', new Reference('http_client'))
->replaceArgument('$dispatcher', new Reference('event_dispatcher'));
->replaceArgument('$client', new Reference('http_client', ContainerBuilder::NULL_ON_INVALID_REFERENCE))
->replaceArgument('$dispatcher', new Reference('event_dispatcher', ContainerBuilder::NULL_ON_INVALID_REFERENCE));
} elseif (ContainerBuilder::willBeAvailable('symfony/mercure-notifier', MercureTransportFactory::class, $parentPackages, true)) {
$container->removeDefinition($classToServices[MercureTransportFactory::class]);
}
Expand All @@ -2605,16 +2605,16 @@ private function registerNotifierConfiguration(array $config, ContainerBuilder $
$container->getDefinition($classToServices[FakeChatTransportFactory::class])
->replaceArgument('$mailer', new Reference('mailer'))
->replaceArgument('$logger', new Reference('logger'))
->replaceArgument('$client', new Reference('http_client'))
->replaceArgument('$dispatcher', new Reference('event_dispatcher'));
->replaceArgument('$client', new Reference('http_client', ContainerBuilder::NULL_ON_INVALID_REFERENCE))
->replaceArgument('$dispatcher', new Reference('event_dispatcher', ContainerBuilder::NULL_ON_INVALID_REFERENCE));
}

if (ContainerBuilder::willBeAvailable('symfony/fake-sms-notifier', FakeSmsTransportFactory::class, ['symfony/framework-bundle', 'symfony/notifier', 'symfony/mailer'], true)) {
$container->getDefinition($classToServices[FakeSmsTransportFactory::class])
->replaceArgument('$mailer', new Reference('mailer'))
->replaceArgument('$logger', new Reference('logger'))
->replaceArgument('$client', new Reference('http_client'))
->replaceArgument('$dispatcher', new Reference('event_dispatcher'));
->replaceArgument('$client', new Reference('http_client', ContainerBuilder::NULL_ON_INVALID_REFERENCE))
->replaceArgument('$dispatcher', new Reference('event_dispatcher', ContainerBuilder::NULL_ON_INVALID_REFERENCE));
}

if (isset($config['admin_recipients'])) {
Expand Down

0 comments on commit 50606d3

Please sign in to comment.