Coming from #2013939: Remove hook_field_[CRUD]_() in favor of hook_ENTITY_TYPE_[CRUD]() calls - field_has_data() should move to a method.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | 2018731-move-field-has-data-11.patch | 21.32 KB | swentel |
| #11 | interdiff.txt | 2.58 KB | swentel |
| #8 | 2018731-move-field-has-data-8.patch | 21.76 KB | swentel |
| #8 | interdiff.txt | 610 bytes | swentel |
| #6 | 2018731-move-field-has-data-6.patch | 21.75 KB | swentel |
Comments
Comment #1
swentel commentedTagging
Comment #2
swentel commentedLet's see.
Comment #4
yched commentedThis looks good to me - well, aside from the test fails ;-)
Comment #5
swentel commenteduhu, fixing them now, patch in a few minutes :)
Also, I've just added a protected property locally so we can do something like this (like getStorageDetails() or getSchema(): good or not ?
Comment #6
swentel commentedForgot an insane amount of code to remove :)
Comment #8
swentel commentedEven betterer
Comment #9
yched commentedWell, I initially wanted to go that way too but caching that is a problem IMO. This info can get stale, and it's not easy to find the right places to clear it. I mean, an entity can have been created in a concurrent request, and there's no way to detect that.
[edit: and bad things can happen if we return false positives or false negatives here - especially false negatives, because we allow more things on a field that is supposed to be "empty"]
So given that in practice, very few code will need that data, I think it's fine to recompute it each time someone needs it.
Then all this patch does is move the code to a method, which is fine IMO.
Comment #11
swentel commentedYeah, makes sense indeed.
Comment #12
yched commentedThanks !
RTBC if green.
Comment #14
swentel commented#11: 2018731-move-field-has-data-11.patch queued for re-testing.
Comment #15
swentel commentedMajor botfluke. RTBC as per #12
Comment #16
yched commentedYay ! Thanks !
Comment #17
alexpottCommitted 30f6062 and pushed to 8.x. Thanks!
Comment #18
alexpottOh... this will need a change notitce... field_has_data existed in D7...
Comment #19
chx commentedhttps://drupal.org/node/2021853
Comment #21
xjmUntagging. Please remove the tag when the change notification task is completed.