Skip to content

[FrameworkBundle] message_bus alias public #28216

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
Aug 19, 2018

Conversation

sroze
Copy link
Contributor

@sroze sroze commented Aug 17, 2018

Q A
Branch? 4.1
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #28215
License MIT
Doc PR ø

Because it is used in the ControllerTrait with get('message_bus')... same than for security.csrf.token_manager and cie, it should be public.

@chalasr
Copy link
Member

chalasr commented Aug 17, 2018

ControllerTrait deals with a service locator, services provided by a service locator do not need to be public (and should not).
I see no good reason for making the command bus public, container aware stuff make no sense anymore (really since 4.1).

@chalasr
Copy link
Member

chalasr commented Aug 17, 2018

hmm, ControllerTrait is used by the FrameworkBundle's Controller class...

@nicolas-grekas nicolas-grekas added this to the 4.1 milestone Aug 17, 2018
@nicolas-grekas
Copy link
Member

It's time to deprecate Controller :)

@sroze
Copy link
Contributor Author

sroze commented Aug 17, 2018

In the meantime... this is still a bug to fix 🙃

@@ -1488,7 +1488,7 @@ private function registerMessengerConfiguration(array $config, ContainerBuilder
$container->register($busId, MessageBus::class)->addArgument(array())->addTag('messenger.bus');

if ($busId === $config['default_bus']) {
$container->setAlias('message_bus', $busId);
$container->setAlias('message_bus', $busId)->setPublic(true);
Copy link
Member

Choose a reason for hiding this comment

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

or $container->setAlias('message_bus', new Alias($busId, true));

Copy link
Member

Choose a reason for hiding this comment

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

Yep. using setPublic is more explicit to me :)

Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

Sadly :)

@MatTheCat
Copy link
Contributor

What would be the consequence of removing Controller ? Would impacted controllers have to use ControllerTrait ?

@nicolas-grekas
Copy link
Member

ControllerTrait is internal. The consequence would be to ask people to use AbstractController instead.

@fabpot
Copy link
Member

fabpot commented Aug 19, 2018

Thank you @sroze.

@fabpot fabpot merged commit 51b6e9e into symfony:4.1 Aug 19, 2018
fabpot added a commit that referenced this pull request Aug 19, 2018
This PR was merged into the 4.1 branch.

Discussion
----------

[FrameworkBundle] `message_bus` alias public

| Q             | A
| ------------- | ---
| Branch?       | 4.1
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #28215
| License       | MIT
| Doc PR        | ø

Because it is used in the `ControllerTrait` with `get('message_bus')`... same than for `security.csrf.token_manager` and cie, it should be public.

Commits
-------

51b6e9e Make the `message_bus` alias public
@MatTheCat
Copy link
Contributor

Oh okay I better use AbstractController right now then?

@sroze
Copy link
Contributor Author

sroze commented Aug 21, 2018 via email

@fabpot fabpot mentioned this pull request Aug 28, 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.

7 participants