You are here

class EntityReferenceDependencyManager in Entity Reference Integrity 8

Calculate entity dependencies based on entity reference fields.

Hierarchy

Expanded class hierarchy of EntityReferenceDependencyManager

Deprecated

Use the entity handler instead.

1 string reference to 'EntityReferenceDependencyManager'
entity_reference_integrity.services.yml in ./entity_reference_integrity.services.yml
entity_reference_integrity.services.yml
1 service uses EntityReferenceDependencyManager
entity_reference_integrity.dependency_manager in ./entity_reference_integrity.services.yml
\Drupal\entity_reference_integrity\EntityReferenceDependencyManager

File

src/EntityReferenceDependencyManager.php, line 13

Namespace

Drupal\entity_reference_integrity
View source
class EntityReferenceDependencyManager implements EntityReferenceDependencyManagerInterface {

  /**
   * The entity type manager.
   *
   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
   */
  protected $entityTypeManager;

  /**
   * Create an EntityReferenceDependencyManager.
   */
  public function __construct(EntityTypeManagerInterface $entityTypeManager) {
    $this->entityTypeManager = $entityTypeManager;
  }

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

  /**
   * {@inheritdoc}
   */
  public function getDependentEntityIds(EntityInterface $entity) {
    return $this->entityTypeManager
      ->getHandler($entity
      ->getEntityTypeId(), 'entity_reference_integrity')
      ->getDependentEntityIds($entity);
  }

  /**
   * {@inheritdoc}
   */
  public function getDependentEntities(EntityInterface $entity) {
    return $this->entityTypeManager
      ->getHandler($entity
      ->getEntityTypeId(), 'entity_reference_integrity')
      ->getDependentEntities($entity);
  }

  /**
   * {@inheritdoc}
   */
  public static function getAccessDeniedReason(EntityInterface $entity, bool $translate = TRUE) {
    return EntityReferenceIntegrityEntityHandler::getAccessDeniedReason($entity, $translate);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EntityReferenceDependencyManager::$entityTypeManager protected property The entity type manager.
EntityReferenceDependencyManager::getAccessDeniedReason public static function Build an access denied reason string. Overrides EntityReferenceDependencyManagerInterface::getAccessDeniedReason
EntityReferenceDependencyManager::getDependentEntities public function List the entities that reference the given entity. Overrides EntityReferenceDependencyManagerInterface::getDependentEntities
EntityReferenceDependencyManager::getDependentEntityIds public function List the entity IDs that reference the given entity. Overrides EntityReferenceDependencyManagerInterface::getDependentEntityIds
EntityReferenceDependencyManager::hasDependents public function Check if an entity has dependent entties. Overrides EntityReferenceDependencyManagerInterface::hasDependents
EntityReferenceDependencyManager::__construct public function Create an EntityReferenceDependencyManager.