You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While creating a set of interrelated commerce entities at the outset of my scenario, I ran into an inability to set the commerce_product_variation's base price field, and the commerce_product's variations field. I tracked it down to a combination of missing entity-level functionality in this and the related drupalextension project.
In this DrupalDriver project, I found that special "expanding" is done to field values prior to actual entity creation. This is absolutely necessary for setting an entity reference field like commerce_product.variations. Unfortunately, expansion is currently only done on non-base fields, preventing me from successfully setting a base field like commerce_product.variations from my scenario.
I also found this driver currently assumes an entity ID key of id, which is not universal to all entity types. Going instead with whatever the entity type's ID key actually is would make entity clean up more straightforward and would open up entityCreate() to be utilized across node, user, and taxonomy term creation methods (reducing repeated entity creation code and centralizing where an entity, of whatever type, is created).
The text was updated successfully, but these errors were encountered:
chrisolof
added a commit
to chrisolof/DrupalDriver
that referenced
this issue
Mar 6, 2024
…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
While creating a set of interrelated commerce entities at the outset of my scenario, I ran into an inability to set the
commerce_product_variation
's baseprice
field, and thecommerce_product
'svariations
field. I tracked it down to a combination of missing entity-level functionality in this and the related drupalextension project.In this DrupalDriver project, I found that special "expanding" is done to field values prior to actual entity creation. This is absolutely necessary for setting an entity reference field like
commerce_product
.variations
. Unfortunately, expansion is currently only done on non-base fields, preventing me from successfully setting a base field likecommerce_product
.variations
from my scenario.I also found this driver currently assumes an entity ID key of
id
, which is not universal to all entity types. Going instead with whatever the entity type's ID key actually is would make entity clean up more straightforward and would open up entityCreate() to be utilized across node, user, and taxonomy term creation methods (reducing repeated entity creation code and centralizing where an entity, of whatever type, is created).The text was updated successfully, but these errors were encountered: