You are here

public function EntityReferenceIntegrityEntityHandler::getDependentEntities in Entity Reference Integrity 8

List the entities that reference the given entity.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity.

Return value

array Array of entity type IDs with arrays of loaded entities.

Overrides EntityReferenceDependencyManagerInterface::getDependentEntities

File

src/EntityReferenceIntegrityEntityHandler.php, line 90

Class

EntityReferenceIntegrityEntityHandler
Entity reference integrity entity handler.

Namespace

Drupal\entity_reference_integrity

Code

public function getDependentEntities(EntityInterface $entity) {
  $entities = $this
    ->getDependentEntityIds($entity);
  $loaded_entities = [];
  foreach ($entities as $entity_type_id => $ids) {
    $loaded_entities[$entity_type_id] = array_values($this->entityTypeManager
      ->getStorage($entity_type_id)
      ->loadMultiple($ids));
  }
  return $loaded_entities;
}