Skip to content

Commit ff554ec

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 ------- feddf407d2 [DebugBundle][FrameworkBundle] Fix using the framework without the Console component
2 parents 68b2f19 + 61464b7 commit ff554ec

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

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)