From feddf407d2c912b32c479cb2d210a3c3136b4a64 Mon Sep 17 00:00:00 2001 From: HypeMC Date: Tue, 11 Jul 2023 23:42:03 +0200 Subject: [PATCH] [DebugBundle][FrameworkBundle] Fix using the framework without the Console component --- .../DependencyInjection/DebugExtension.php | 3 ++- .../DependencyInjection/FrameworkExtension.php | 14 ++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Symfony/Bundle/DebugBundle/DependencyInjection/DebugExtension.php b/src/Symfony/Bundle/DebugBundle/DependencyInjection/DebugExtension.php index bce977e9b1197..4b709eb508928 100644 --- a/src/Symfony/Bundle/DebugBundle/DependencyInjection/DebugExtension.php +++ b/src/Symfony/Bundle/DebugBundle/DependencyInjection/DebugExtension.php @@ -14,6 +14,7 @@ use Symfony\Bridge\Monolog\Command\ServerLogCommand; use Symfony\Bundle\DebugBundle\Command\ServerDumpPlaceholderCommand; use Symfony\Component\Config\FileLocator; +use Symfony\Component\Console\Command\Command; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Extension\Extension; use Symfony\Component\DependencyInjection\Loader\PhpFileLoader; @@ -92,7 +93,7 @@ public function load(array $configs, ContainerBuilder $container) ; } - if (!class_exists(ServerLogCommand::class)) { + if (!class_exists(Command::class) || !class_exists(ServerLogCommand::class)) { $container->removeDefinition('monolog.command.server_log'); } } diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 82b798b18e698..206bda1039a44 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -2154,12 +2154,14 @@ private function registerMessengerConfiguration(array $config, ContainerBuilder ->replaceArgument(0, $transportRetryReferences); if (\count($failureTransports) > 0) { - $container->getDefinition('console.command.messenger_failed_messages_retry') - ->replaceArgument(0, $config['failure_transport']); - $container->getDefinition('console.command.messenger_failed_messages_show') - ->replaceArgument(0, $config['failure_transport']); - $container->getDefinition('console.command.messenger_failed_messages_remove') - ->replaceArgument(0, $config['failure_transport']); + if ($this->hasConsole()) { + $container->getDefinition('console.command.messenger_failed_messages_retry') + ->replaceArgument(0, $config['failure_transport']); + $container->getDefinition('console.command.messenger_failed_messages_show') + ->replaceArgument(0, $config['failure_transport']); + $container->getDefinition('console.command.messenger_failed_messages_remove') + ->replaceArgument(0, $config['failure_transport']); + } $failureTransportsByTransportNameServiceLocator = ServiceLocatorTagPass::register($container, $failureTransportReferencesByTransportName); $container->getDefinition('messenger.failure.send_failed_message_to_failure_transport_listener')