I am using the TreeRebuider service to calculate the hierarchy of my entities after a migration. When the batch process executes I get the following error.
Notice: Undefined index: my_field_target_id in Drupal\entity_hierarchy\Storage\TreeRebuilder->treeSort() (line 183 of /shared/httpd/oipp/app/web/modules/contrib/entity_hierarchy/src/Storage/TreeRebuilder.php) .
I am using a base field for my entity_reference_hierarchy and base fields use double underscore "__" for their secondary attributes, thus my target_id field is ultimately my_field__target_id, and is ignored during the tree building process. The same problem was tackled in another issue for a different case.
Additionally I see that the same pattern is used in entity_hierarchy_field_views_data relationship declaration, but afaik this hook affects only config fields and it should be ok. (If I am mistaken we should probably remedy this too)
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | entity_hierarchy-3263416-5.patch | 4.72 KB | marios anagnostopoulos |
Comments
Comment #2
marios anagnostopoulos commentedComment #3
marios anagnostopoulos commentedFixed tests and cs issues.
Comment #4
larowlanCode looks good, just need to sort the unit-test fails
Thanks for opening
Comment #5
marios anagnostopoulos commentedWell that was embarrassing. I fixed the existing test (I hope... at least when I run phpunit localy it passes). Do you think we need to extend the test case or is it gtg?
Comment #7
larowlanNa, good to go I think
This will go out as 3.0.5