- πΊπΈUnited States caspervoogt
In my case, I have a site with users containing CER fields, meaning I can't delete users while the that CER is enabled. My workaround is to temporarily disable the CER, delete the users, then re-enable the CER.
- π³π±Netherlands heine
This bug happens when other delete hooks run while cer_entity_delete is in flight, for instance when deleting certain referenced items on hook_entity_delete that have a cer controlled field.
This causes \Drupal\cer\Entity\CorrespondingReference::synchronizeCorrespondingFields() to run with a list of entities that are in the loader cache, but no longer exist. EntityStorageBase won't be able to load the original anymore, causing $entity->original to be empty, triggering the exception.
I found that calling the following and checking for non-null during the inner loop in \Drupal\cer\Entity\CorrespondingReference::synchronizeCorrespondingFields() fixes the issue for that particular site.
$original = $this->entityTypeManager() ->getStorage($correspondingEntity->getEntityTypeId()) ->loadUnchanged($correspondingEntity->id()); if ($original) { $this->synchronizeCorrespondingField($entity, $correspondingEntity, $correspondingField, $operation); }