Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[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

Merged
merged 1 commit into from
Jul 25, 2018

Conversation

sroze
Copy link
Contributor

@sroze sroze commented Jul 20, 2018

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 :)

@sroze
Copy link
Contributor Author

sroze commented Jul 20, 2018

fabbot's review is to be discarded in this PR :)

@nicolas-grekas nicolas-grekas added this to the 4.1 milestone Jul 23, 2018
@@ -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);
Copy link
Member

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);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, changed.

@sroze sroze force-pushed the fix-chaining-senders-with-their-aliases branch from 882d410 to 98bb64c Compare July 23, 2018 10:44
$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".');
Copy link
Member

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.

Copy link
Contributor Author

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 :)

Copy link
Member

@chalasr chalasr Jul 24, 2018

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

@sroze sroze merged commit 98bb64c into symfony:4.1 Jul 25, 2018
sroze added a commit that referenced this pull request Jul 25, 2018
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
@sroze sroze deleted the fix-chaining-senders-with-their-aliases branch July 25, 2018 08:06
@fabpot fabpot mentioned this pull request Aug 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants