Enhance entity creation with base field expansion and dynamic id key#271
Enhance entity creation with base field expansion and dynamic id key#271chrisolof wants to merge 3 commits intojhedstrom:masterfrom
Conversation
…nsion Per FieldHandlerInterface::expand(), field handlers expect an array of field values. The source entity object passed into expandEntityFields() often has an inconsistent structure across its various field properties, sometimes holding a single value, sometimes holding an array of values (as expected), and sometimes holding an array of composite field parts for a single field value. Consistently providing field handlers the field values in the structure they expect allows them to expand each field value correctly. jhedstromgh-270
|
Hey @chrisolof - thanks for this contribution! This is a significant refactor that consolidates entity creation into a unified flow. We're planning to tackle this as part of the v3.x effort (see #312) where we'll have kernel tests to properly validate the changes. I'll leave this open as reference for that work. Appreciate the thoughtful implementation! |
|
Hey @chrisolof - thanks for this contribution! Master has moved on significantly since this was opened (v3.x restructure, capability interfaces, kernel tests), so a clean rebase was not viable - but your insight absolutely was. I have opened #346 which reimplements the two bugs you identified against current master: auto-detection of base fields in expandEntityFields so commerce_product.variations and similar base entity-reference fields go through the handler pipeline, and dynamic id key resolution in entityCreate/entityDelete. Your original PR is attributed at the top of #346, and there is a dedicated kernel test covering the commerce_product to variations scenario you originally hit. I will close this PR once #346 lands. Appreciate you catching these! |
|
Landed via #346. Thanks again, @chrisolof! |
Resolves #270.
Pairs really well with jhedstrom/drupalextension/pull/661.