- 🇧🇪Belgium dieterholvoet Brussels
I was experiencing a similar issue: I was trying to get the referenced entities in a constraint validator in the parent entity as well, but I was trying to get them using
$child_entities = $items->get('child_entity_field')->referencedEntities();
. That should have worked but didn't, and after a lot of digging I found out why: 🐛 EntityReferenceFieldItemList::referencedEntities might not return up-to-date entity objects Needs work .So in short: please try to include a patch from the MR in 🐛 EntityReferenceFieldItemList::referencedEntities might not return up-to-date entity objects Needs work in your project and try to load the entities using
referencedEntities()
, that should give you the result you need. Let me know if that doesn't fix your issue.