Updated: Comment #6
Problem/Motivation
Settings::getSingleton()->get('foo'); is far uglier and less intuitive than it could be.
Proposed resolution
Replace with:
Settings::get('foo');
Similarly provide Settings::getAll(); and rename the ->get() instance method.
Remaining tasks
convert existing code
User interface changes
N/A
API changes
changes the method for getting settings - remove settings() function and only use static methods on the class.
| Comment | File | Size | Author |
|---|---|---|---|
| #17 | 2219009-17.patch | 617 bytes | pwolanin |
| #12 | 2219009-12.patch | 47.94 KB | pwolanin |
| #8 | 2219009-8.patch | 48.03 KB | pwolanin |
| #8 | increment.txt | 833 bytes | pwolanin |
| #6 | 2219009-6.patch | 48.03 KB | pwolanin |
Comments
Comment #1
pwolanin commentedHere's a 1st pass
Comment #2
sun+1 — Thanks a ton for fixing this method name.
Minor: Missing newline :)
Let's make those methods private now.
Comment #3
sunComment #5
pwolanin commented@sun - the instance methods are still used in the unit test. Should we use the static methods there instead?
Comment #6
pwolanin commentedThis should fix the test fatal (missing use) and suns suggestions.
Comment #8
pwolanin commentedHmm, turns out the instance is injected into a bunch of core services (e.g. string_translator.custom_strings)
Let's see if it passes with those methods left public.
Comment #9
sunLooks awesome to me.
FWIW, one idea raised in #2199795: Make the Settings class prevent serialization of actual settings is to no longer expose
Settingsas a service (because it cannot be serialized as part of other service instances), so those instances might go away. Just mentioning for completeness.Comment #10
pwolanin commentedYes, seems like there is more cleanup that could be tackled after this - having it as a service doesn't seem to make much sense as we are doing it: it's not generally accessed that way, so you can't swap it.
Comment #12
pwolanin commentedpretty trivial conflict in CoreServiceProvider.php
Here's a re-roll.
Comment #13
pwolanin commentedComment #14
pwolanin commentedok, back to rtbc since it's passing all tests again.
Comment #16
alexpottCommitted 000966e and pushed to 8.x. Thanks!
Comment #17
pwolanin commentedstupidly missed the use in the catch in index.php
Comment #18
ianthomas_ukThis needs CRs to be updated, especially https://drupal.org/node/1882698.
I'm working on them now.
Comment #19
wim leersMost trivial patch of the month award goes to pwolanin! :)
Comment #20
webchickSince testbot obviously isn't testing this code path, I think it's fine to commit this before it's back. However, we should make a major issue to somehow add test coverage for this, because that's very un-good.
Meanwhile, committed and pushed to 8.x. Thanks!
Comment #21
fgmThis commit does not seem to have made it to Git, even online https://drupal.org/node/3060/commits
Comment #22
webchickWeird. Take 2!
Comment #24
damiankloip commentedSo, just out of interest, how is it this normal task gets committed so quickly when other issues have been waiting much longer? :)
Comment #26
ParisLiakos commentedfollow up #2250491: Remove duplicate methods from Settings class
i dont really see the point of duplicating the methods