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).
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).