Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
TypedConfigInterface::set()
is unused but for ConfigSchemaTest
.
Proposed resolution
Remove it.
Remaining tasks
User interface changes
None.
API changes
TypedConfigInterface::set()
is removed.
Beta phase evaluation
Issue category | Task because nothing is broken |
---|---|
Issue priority | Normal |
Unfrozen changes | Not unfrozen |
Prioritized changes | Not prioritized |
Disruption | Disruptive for core/contributed and custom modules that use TypeConfigInterface::set() . TypedConfigInterface is rather new, however, both Mapping and Sequence used to have a set() method before #2298687: Sequence and Mapping implement interfaces incorrectly, make them honest about what they support. Still, it is very hard to imagine this method being used. Basically you can use a config schema wrapper to set a config value. If you are using the config schema wrapper at all in your module, you are most probably using it for validation or for getting some sort of metadata about the config, for example whether it is translatable. I'm certain most people are not aware that it's even possible to set a configuration via the wrapper and it's very unintuitive and also completely unnecessary, because whenever you would use it, you probably have a config object at hand, anyway, which you can use to set the configuration value. This is the reason that the Configuration Translation module does not use this method, for example, even though it uses the configuration schema wrapper extensively. The benefit of this change is that it makes it more easily possible to bring config schema inline with the rest of typed data in the future, either in 8.1.x or in contrib and that you do not need to implement a pointless method if you want to provide a new implementation of TypedConfigInterface . |
Comment | File | Size | Author |
---|---|---|---|
#26 | remove-2429157-23.patch | 2.61 KB | rpayanm |
#26 | interdiff-2449743-17-23.txt | 1.08 KB | rpayanm |
Comments
Comment #1
hussainwebWith #2298687: Sequence and Mapping implement interfaces incorrectly, make them honest about what they support, I think we are good to go with this. Starting with a simple patch.
Comment #3
amateescu CreditAttribution: amateescu commentedShortcut module is the new configuration system? :P
Comment #4
mtiftComment #5
root_brute CreditAttribution: root_brute commentedRemoved
TypedConfigInterface
methods fromConfigSchemaTest
Comment #6
root_brute CreditAttribution: root_brute commentedRemoved set method from
TypedConfigInterface
and also fromArrayElement
becauseArrayElement
implementsTypedConfigInterface
.Comment #8
tstoecklerOK, so let's roll #5 and #6 into one patch and then I'll RTBC :-)
Comment #9
joshi.rohit100Merged #5 and #6 into one.
Comment #11
rteijeiro CreditAttribution: rteijeiro commentedFixed failing test.
Comment #13
joshi.rohit100Fixed the exception
Comment #15
tstoecklerLet's just remove that whole hunk. It's also testing the method we're removing here.
Comment #16
root_brute CreditAttribution: root_brute commentedComment #17
sidharthapRemoved the whole hunk as suggested on #15. Please correct me if something wrong here.
Comment #18
tstoecklerNope, that's perfect. Was about to RTBC but we need a beta evaluation here. Will do that tomorrow if no one beats me to it.
Comment #19
root_brute CreditAttribution: root_brute commented@tstoeckler the commit i did in comment #5 isn't necessary. should i remove it and upload the patch once more?
Comment #20
tstoecklerRe #19: Ahh, yes you're right. The first hunk that is removed from the test in fact tests the
get()
method, not theset()
method. Yes, let's revert that commit and leave that part of the test in. Thanks, I had missed that!Comment #21
tstoecklerAdded a beta evaluation. Let's see what committers say. There is some theoretical disruption here, that can't be argued away, but I think it's really, really small, and the benefits greatly outweigh it in my opinion. We'll see.
Comment #22
tstoecklerComment #23
root_brute CreditAttribution: root_brute commentedAdded back the hunk that tested
get()
method.Comment #24
tstoecklerAwesome, thanks!
Comment #26
rpayanmHere only copy/paste. Because interdiff extension is .patch and is tested by the testing bot.
@root_brute the interdiff extension files must be .txt
More info: https://www.drupal.org/documentation/git/interdiff
Comment #27
root_brute CreditAttribution: root_brute commented@tstoeckler welcome :)
@rpayanm thanks for the insight.
Comment #28
alexpottPrevent setting config using typed config makes a lot of sense. I think this reduces fragility since that config could not actually be saved. Committed b9045f6 and pushed to 8.0.x. Thanks!
Thanks for adding the beta evaluation to the issue summary.
Comment #30
rpayanm@root_brute you are welcome, thank you for contribute to drupal :)