Skip to content

[FrameworkBundle] Mark cache.default_*_provider services private #20577

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
Nov 21, 2016

Conversation

nicolas-grekas
Copy link
Member

Q A
Branch? 3.1
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #20563
License MIT
Doc PR -

I know making a service private has a potential for breaking BC. Yet, these services should not be used directly in controllers/userland code, and I really doubt anyone did. Let's make it private now and fix linked issue (even if it's a false positive from SymfonyServiceDefinitionValidator, it shows we have this service that really isn't meant to be public).

@fabpot
Copy link
Member

fabpot commented Nov 21, 2016

Thank you @nicolas-grekas.

@fabpot fabpot merged commit 09adfda into symfony:3.1 Nov 21, 2016
fabpot added a commit that referenced this pull request Nov 21, 2016
…rivate (nicolas-grekas)

This PR was merged into the 3.1 branch.

Discussion
----------

[FrameworkBundle] Mark cache.default_*_provider services private

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

I know making a service private has a potential for breaking BC. Yet, these services should not be used directly in controllers/userland code, and I really doubt anyone did. Let's make it private now and fix linked issue (even if it's a false positive from SymfonyServiceDefinitionValidator, it shows we have this service that really isn't meant to be public).

Commits
-------

09adfda [FrameworkBundle] Mark cache.default_*_provider services private
@@ -1045,6 +1045,7 @@ private function registerCacheConfiguration(array $config, ContainerBuilder $con
foreach (array('doctrine', 'psr6', 'redis') as $name) {
if (isset($config[$name = 'default_'.$name.'_provider'])) {
$container->setAlias('cache.'.$name, Compiler\CachePoolPass::getServiceProvider($container, $config[$name]));
$container->getAlias('cache.'.$name)->setPublic(false);
Copy link
Member

Choose a reason for hiding this comment

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

you could even set it as private directly instead of getting the alias again:

setAlias('cache.'.$name, new Alias(..., false));

@nicolas-grekas nicolas-grekas deleted the cache-alias-private branch November 22, 2016 15:07
@fabpot fabpot mentioned this pull request Nov 27, 2016
fabpot added a commit that referenced this pull request Nov 29, 2016
…(xabbuh)

This PR was merged into the 3.1 branch.

Discussion
----------

[FrameworkBundle] mark alias as private during creation

| Q             | A
| ------------- | ---
| Branch?       | 3.1
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #20577 (comment)
| License       | MIT
| Doc PR        | n/a

Commits
-------

828c761 mark alias as private during creation
@fabpot fabpot mentioned this pull request Dec 13, 2016
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.

4 participants