You are here

public function EntityLegalDocument::getAllVersions in Entity Legal 8.2

Same name and namespace in other branches
  1. 4.0.x src/Entity/EntityLegalDocument.php \Drupal\entity_legal\Entity\EntityLegalDocument::getAllVersions()
  2. 3.0.x src/Entity/EntityLegalDocument.php \Drupal\entity_legal\Entity\EntityLegalDocument::getAllVersions()

Get all versions of this legal document entity.

Return value

array All versions of this legal document entity.

Overrides EntityLegalDocumentInterface::getAllVersions

2 calls to EntityLegalDocument::getAllVersions()
EntityLegalDocument::delete in src/Entity/EntityLegalDocument.php
Deletes an entity permanently.
EntityLegalDocument::getAcceptances in src/Entity/EntityLegalDocument.php
Get the acceptances for this entity legal document revision.

File

src/Entity/EntityLegalDocument.php, line 128

Class

EntityLegalDocument
Defines the entity legal document entity.

Namespace

Drupal\entity_legal\Entity

Code

public function getAllVersions() {
  $query = \Drupal::entityQuery(ENTITY_LEGAL_DOCUMENT_VERSION_ENTITY_NAME)
    ->condition('document_name', $this
    ->id());
  $results = $query
    ->execute();
  if (!empty($results)) {
    return \Drupal::entityTypeManager()
      ->getStorage(ENTITY_LEGAL_DOCUMENT_VERSION_ENTITY_NAME)
      ->loadMultiple($results);
  }
  else {
    return [];
  }
}