Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
field system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
12 Aug 2014 at 22:45 UTC
Updated:
9 Sep 2014 at 14:10 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
yched commentedComment #2
yched commentedSame for FieldStorageConfig, actually.
Patch.
Comment #4
yched commentedOur code needs to run before the parent's
Comment #5
yched commentedForgot the interdiff
Comment #8
swentel commentedProbably bot fluke.
Related question though: most other config entities call the parent function at the top of the code, not the beginning. Don't think it will make much difference I guess ?
Comment #9
swentel commentedComment #10
yched commented@swentel:
Patch #2 called the parent at the top and got a test fail.
I didn't really investigate, but in #2283977-133: Create a new ConfigEntity type for storing bundle-specific customizations of base fields I did a similar remark about the location of the parent call in BaseFieldOverride::preSave(), and in the next patch @alexpott apparently could not do better than place it after the line that does
$this->settings += [default settings]".Probably something like "all settings need to be present before we try to calculate dependencies" - which seem be reasonable ?
So given the shape of FieldInstanceConfig::preSave() and FieldStorageConfig::preSave(), I chose to move the call straight to the bottom rather than in an awkard middle position.
This being said, not sure why we initialize default settings in preSave(), this leaves freshly created entities broken for runtime use (incomplete settings) until they are actually saved. We should do this as early as postCreate().
Comment #12
yched commentedAsking for a re-test of #2 though.
Comment #13
swentel commentedOh right, ok, nevermind then, RTBC for #4.
Damn, next time I should really investigate two patches in such a small issue :)
Comment #16
webchickGood catch.
Committed and pushed to 8.x. Thanks!
Comment #17
yched commentedPatch in #2327883: Field [storage] config have incomplete settings until they are saved