You are here

public function EntityReferenceDependencyManager::hasDependents in Entity Reference Integrity 8

Check if an entity has dependent entties.

Parameters

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

Return value

bool If the entity is referenced from elsewhere.

Overrides EntityReferenceDependencyManagerInterface::hasDependents

File

src/EntityReferenceDependencyManager.php, line 32

Class

EntityReferenceDependencyManager
Calculate entity dependencies based on entity reference fields.

Namespace

Drupal\entity_reference_integrity

Code

public function hasDependents(EntityInterface $entity) {
  return $this->entityTypeManager
    ->getHandler($entity
    ->getEntityTypeId(), 'entity_reference_integrity')
    ->hasDependents($entity);
}