Skip to content

Commit

Permalink
bug #50945 [DebugBundle][FrameworkBundle] Fix using the framework wit…
Browse files Browse the repository at this point in the history
…hout 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
  • Loading branch information
nicolas-grekas committed Jul 13, 2023
2 parents 68b2f19 + 61464b7 commit ff554ec
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions DependencyInjection/FrameworkExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit ff554ec

Please sign in to comment.