Skip to content

Commit 97bd5a0

Browse files
bug #50945 [DebugBundle][FrameworkBundle] Fix using the framework without the Console component (HypeMC)
This PR was merged into the 5.4 branch. Discussion ---------- [DebugBundle][FrameworkBundle] Fix using the framework without the Console component | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - While working on #50787 I've noticed that it's impossible to use the framework without the Console component, event though it's an optional dependency. This PR aims to fix that. I've tested these changes on 5.4 & 6.3, however, I only made sure the container can compile. I'm not sure if there are any other gotchas. Commits ------- feddf40 [DebugBundle][FrameworkBundle] Fix using the framework without the Console component
2 parents e8dc1c2 + feddf40 commit 97bd5a0

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/Symfony/Bundle/DebugBundle/DependencyInjection/DebugExtension.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Bridge\Monolog\Command\ServerLogCommand;
1515
use Symfony\Bundle\DebugBundle\Command\ServerDumpPlaceholderCommand;
1616
use Symfony\Component\Config\FileLocator;
17+
use Symfony\Component\Console\Command\Command;
1718
use Symfony\Component\DependencyInjection\ContainerBuilder;
1819
use Symfony\Component\DependencyInjection\Extension\Extension;
1920
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
@@ -92,7 +93,7 @@ public function load(array $configs, ContainerBuilder $container)
9293
;
9394
}
9495

95-
if (!class_exists(ServerLogCommand::class)) {
96+
if (!class_exists(Command::class) || !class_exists(ServerLogCommand::class)) {
9697
$container->removeDefinition('monolog.command.server_log');
9798
}
9899
}

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2154,12 +2154,14 @@ private function registerMessengerConfiguration(array $config, ContainerBuilder
21542154
->replaceArgument(0, $transportRetryReferences);
21552155

21562156
if (\count($failureTransports) > 0) {
2157-
$container->getDefinition('console.command.messenger_failed_messages_retry')
2158-
->replaceArgument(0, $config['failure_transport']);
2159-
$container->getDefinition('console.command.messenger_failed_messages_show')
2160-
->replaceArgument(0, $config['failure_transport']);
2161-
$container->getDefinition('console.command.messenger_failed_messages_remove')
2162-
->replaceArgument(0, $config['failure_transport']);
2157+
if ($this->hasConsole()) {
2158+
$container->getDefinition('console.command.messenger_failed_messages_retry')
2159+
->replaceArgument(0, $config['failure_transport']);
2160+
$container->getDefinition('console.command.messenger_failed_messages_show')
2161+
->replaceArgument(0, $config['failure_transport']);
2162+
$container->getDefinition('console.command.messenger_failed_messages_remove')
2163+
->replaceArgument(0, $config['failure_transport']);
2164+
}
21632165

21642166
$failureTransportsByTransportNameServiceLocator = ServiceLocatorTagPass::register($container, $failureTransportReferencesByTransportName);
21652167
$container->getDefinition('messenger.failure.send_failed_message_to_failure_transport_listener')

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy