8000 bug #41553 [Messenger] fix BC for FrameworkBundle 4.4 with a non-exis… · symfony/symfony@d85847c · GitHub
[go: up one dir, main page]

Skip to content

Commit d85847c

Browse files
bug #41553 [Messenger] fix BC for FrameworkBundle 4.4 with a non-existence alias being used (monteiro)
This PR was squashed before being merged into the 5.3 branch. Discussion ---------- [Messenger] fix BC for FrameworkBundle 4.4 with a non-existence alias being used | Q | A | ------------- | --- | Branch? | 5.3 | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Fix #41545 ... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT When trying to update symfony/messenger to 5.3 while still using symfony/framework-bundle 4.4 there is an error: The service "console.command.messenger_failed_messages_retry" has a dependency on a non-existent service "messenger.failure_transports.default". This is because in Symfony Messenger 5.3, on the PR #38468 to support multiple failure transports we have created an alias, that is only available on the FrameworkBundle 5.3. This fix will use an already existence alias. Sample project to test this behavior: https://github.com/monteiro/PR-41553-symfony Commits ------- aa0e166 [Messenger] fix BC for FrameworkBundle 4.4 with a non-existence alias being used
2 parents 22fd960 + aa0e166 commit d85847c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Symfony/Component/Messenger/DependencyInjection/MessengerPass.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,11 @@ private function registerReceivers(ContainerBuilder $container, array $busIds)
260260
$commandDefinition = $container->getDefinition('console.command.messenger_failed_messages_retry');
261261
$globalReceiverName = $commandDefinition->getArgument(0);
262262
if (null !== $globalReceiverName) {
263-
$failureTransportsMap[$commandDefinition->getArgument(0)] = new Reference('messenger.failure_transports.default');
263+
if ($container->hasAlias('messenger.failure_transports.default')) {
264+
$failureTransportsMap[$globalReceiverName] = new Reference('messenger.failure_transports.default');
265+
} else {
266+
$failureTransportsMap[$globalReceiverName] = new Reference('messenger.transport.'.$globalReceiverName);
267+
}
264268
}
265269
}
266270

0 commit comments

Comments
 (0)
0