diff -u b/core/lib/Drupal/Core/Entity/EntityRepository.php b/core/lib/Drupal/Core/Entity/EntityRepository.php --- b/core/lib/Drupal/Core/Entity/EntityRepository.php +++ b/core/lib/Drupal/Core/Entity/EntityRepository.php @@ -63,17 +63,16 @@ */ public function loadEntitiesByUuids($entity_type_id, $uuids) : array { $entity_type = $this->entityTypeManager->getDefinition($entity_type_id); - if (!$uuid_key = $entity_type->getKey('uuid')) { throw new EntityStorageException("Entity type $entity_type_id does not support UUIDs."); } - - $entities_by_id = $this->entityTypeManager->getStorage($entity_type_id)->loadByProperties([$uuid_key => $uuids]); $entities = []; - foreach ($entities_by_id as $entity) { - $entities[$entity->uuid()] = $entity; + foreach ($uuids as $ukey => $uuid_value) { + $key_value = ''; + $entities_by_id = $this->entityTypeManager->getStorage($entity_type_id)->loadByProperties([$uuid_key => $uuid_value]); + $key_value = array_keys($entities_by_id)[0]; + $entities[$entities_by_id[$key_value]->uuid()] = $entities_by_id[$key_value]; } - return $entities; }