Closed (fixed)
Project:
Drupal core
Version:
9.0.x-dev
Component:
configuration entity system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
21 Feb 2020 at 16:11 UTC
Updated:
10 Mar 2020 at 13:09 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
daffie commentedMade the service "config.storage.sync" the default service and the deprecated service "config.storage.staging" an alias of the first. Also added the deprecation line.
Comment #3
daffie commented#3114192: Remove deprecated services in core.services.yml is for 9.0. Lets do the same for this issue.
Comment #4
longwaveThanks for posting the patch.
We should add a test that confirms the deprecation message is triggered as expected.
Comment #5
daffie commentedAdded a test. It fails, but I do not know how to fix it.
Comment #7
longwaveSo I think this has uncovered a bug in our YamlFileLoader, in that aliased services cannot be deprecated - we return early as soon as we find an alias and ignore other keys. Symfony however does support deprecating aliases as per https://symfony.com/blog/new-in-symfony-4-3-deprecating-service-aliases
#3111008: Use native Symfony YamlFileLoader should fix this for good, but for now we can duplicate the service definition instead of aliasing it? Or we can try and fix the YamlFileLoader somehow.
Comment #8
longwaveComment #9
alexpottHmmm... my original thought was duplicating is tricky because people who are altering services are going to be affected. But they already are because they should be using the config.storage.sync service to alter BUT that is currently an alias SO... I think that duplicating in this instance is okay.
I'm also thinking that maybe doing the deprecation in 9.x might be better because having the two services which are not aliased is not great.
Comment #10
alexpottIt is only 1 page of things to fix on http://grep.xnddx.ru/search?text=config.storage.staging&filename=
Comment #11
longwaveThe fix to YamlFileLoader is fairly straightforward, maybe this is better than duplicating the service?
However this doesn't apply to 8.9.x as Symfony\Component\DependencyInjection\Alias::setDeprecated() doesn't exist in Symfony 3.x.
Comment #12
alexpottI think setAlias() returns the alias so you we don't need the hidden assignment.
Doing this only in Drupal 9 seems okay tbh.
Comment #13
longwaveThanks for review, addressed #12 and also improved the deprecation message format so we no longer need the comments above the service.
Comment #15
daffie commentedNow I know why I could not get the test to work.
I have been looking at the method
setAlias()and yes it returns the Alias service. What is confusing is that the method uses the parameters$aliasand$idin a reversed order to how they are used inYamlFileLoaderclass.All the code changes look good to me.
All the remarks of @alexpott have been addressed.
For me it is RTBC.
@longwave and @alexpott: Thanks, I learned something new.
Comment #16
alexpottCommitted a95e111 and pushed to 9.0.x. Thanks!
It would be nice to backport this to 8.9.x since this service is deprecated via a comment there but as SF3 doesn't support deprecating aliases that doesn't seem possible.