-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Messenger] Fix chaining senders with their aliases #28014
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Messenger] Fix chaining senders with their aliases #28014
Conversation
ddff12a
to
882d410
Compare
fabbot's review is to be discarded in this PR :) |
@@ -1503,8 +1519,11 @@ private function registerMessengerConfiguration(array $config, ContainerBuilder | |||
} | |||
|
|||
if (1 < \count($messageConfiguration['senders'])) { | |||
$senders = array_map(function ($sender) { return new Reference($sender); }, $messageConfiguration['senders']); | |||
$senders = array_map(function ($sender) use ($senderAliases) { | |||
return new Reference(isset($senderAliases[$sender]) ? $senderAliases[$sender] : $sender); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return new Reference($senderAliases[$sender] ?? $sender);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, changed.
882d410
to
98bb64c
Compare
$senderAliases = array(); | ||
foreach ($config['transports'] as $name => $transport) { | ||
if (0 === strpos($transport['dsn'], 'amqp://') && !$container->hasDefinition('messenger.transport.amqp.factory')) { | ||
throw new LogicException('The default AMQP transport is not available. Make sure you have installed and enabled the Serializer component. Try enable it or install it by running "composer require symfony/serializer-pack".'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know exception messages must end with a dot, but I'm afraid some people will execute composer require symfony/serializer-pack .
I don't know if this happens in other error messages or if we reword them to never show a console command at the end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's wrapped in "
so I believe it's clear that the dot is not part of the command :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with @sroze, copy-pasting with quotes is broken and the composer exception thrown when adding the dot is clear enough about the mistake. We have a bunch of similar messages in ControllerTrait
This PR was merged into the 4.1 branch. Discussion ---------- [Messenger] Fix chaining senders with their aliases | Q | A | ------------- | --- | Branch? | 4.1 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #27908 | License | MIT | Doc PR | ø Turns out chaining senders when using their alias as the name is broken. This PR fixes it :) Commits ------- 98bb64c Chaining senders with their aliases should work
Turns out chaining senders when using their alias as the name is broken. This PR fixes it :)