You are here

public function EntityReferenceRevisionsOrphanPurger::getCompositeEntityTypes in Entity Reference Revisions 8

Returns a list of composite entity types.

Return value

\Drupal\Core\Entity\EntityTypeInterface[] An array of composite entity types.

File

src/EntityReferenceRevisionsOrphanPurger.php, line 390

Class

EntityReferenceRevisionsOrphanPurger
Manages orphan composite revision deletion.

Namespace

Drupal\entity_reference_revisions

Code

public function getCompositeEntityTypes() {
  $composite_entity_types = [];
  $entity_types = $this->entityTypeManager
    ->getDefinitions();
  foreach ($entity_types as $entity_type) {
    $has_parent_type_field = $entity_type
      ->get('entity_revision_parent_type_field');
    $has_parent_id_field = $entity_type
      ->get('entity_revision_parent_id_field');
    $has_parent_field_name_field = $entity_type
      ->get('entity_revision_parent_field_name_field');
    if ($has_parent_type_field && $has_parent_id_field && $has_parent_field_name_field) {
      $composite_entity_types[] = $entity_type;
    }
  }
  return $composite_entity_types;
}