DynamicEntityReferenceItem::getValue() and DynamicEntityReferenceItem::setValue() are throwing errors when field value is set programmatically.
| Comment | File | Size | Author |
|---|---|---|---|
| #23 | interdiff.txt | 906 bytes | jibran |
| #20 | 2366093-set-value-20.patch | 11.85 KB | jibran |
| #20 | interdiff.txt | 8.55 KB | jibran |
Comments
Comment #2
larowlanWill check this in the morning
Comment #3
larowlanHad a bit of a look into this but didn't get far
Comment #4
larowlanAre you sure that getValues fails? we have tests for that
Comment #5
jibranSorry
InvalidArgumentExceptionis thrown byDynamicEntityReference::setValue()Comment #6
jibranperhaps this will help.
Comment #8
jibranHere is little progress.
Comment #10
amateescu commentedI'll try to take a look tonight :)
Comment #11
jibranThank you very much.
Comment #12
amateescu commentedSorry, didn't make it this evening. I'll try harder tomorrow :/
Comment #13
amateescu commentedThis was the issue that's been eating up my evenings: #2370703: ER's "autocreate" feature is mostly broken (and untested)
You might want to check if the same problems exist in Dynamic ER too.
Comment #14
jibranYeah I am following that will review/test/rtbc it once green :)
Comment #15
jibranI tried some stuff but no luck. This patch is use less but I am uploading it anyway.
Comment #16
jibranThese changes are copied form EntityReference
so when we do
it throws exception when we try to access
$entity->field_test_taxonomy_term->entitybecause entity type id is not set.useless change we don't need this. But we have to update this function cuz base class has updated it.
I dono about this either just trying some stuff.
Main pain point is
$entity->field_test_taxonomy_term->entity = $term;we can't do that at all. But we can set default value of field just fine see http://cgit.drupalcode.org/dynamic_entity_reference/tree/src/Tests/Dynam...Comment #18
larowlan#2002138: Use an adapter for supporting typed data on ContentEntities is where things went awry I think
Comment #19
larowlanHate to say this - but I think I'm starting to understand typed data.
Don't tell anyone.
Comment #20
jibranThank you very much @larowlan for fixing it :)
Done some clean up and added another test. Haven't clean up
DynamicEntityReferenceItemwe'll do it in #2365331: Update DynamicEntityReferenceItem according to EntityReferenceItem.Comment #21
jibranOther then these issue I think it is RTBC.
I think DER should only support this case and throw exception for non entity items. ER has target_type in field_storage so it is ok for it to pass id as entity but not for DER. Thoughts??
ops copy paste gone wrong :/
Comment #22
larowlanWe throw an error if an id is passed but no target_type is set on the parent
I can live with that.
Comment #23
jibranI committed it with following doc fixes.
Comment #25
jibranNext stop is #2365331: Update DynamicEntityReferenceItem according to EntityReferenceItem