You are here

public function UpdateUtils::getLatestRevision in Scheduled Updates 8

Loads the latest revision of a specific entity.

Parameters

string $entity_type_id: The entity type ID.

int $entity_id: The entity ID.

Return value

\Drupal\Core\Entity\ContentEntityInterface|null The latest entity revision or NULL, if the entity type / entity doesn't exist.

Overrides UpdateUtilsInterface::getLatestRevision

File

src/UpdateUtils.php, line 119

Class

UpdateUtils
Service to determine information about Scheduled Update Types.

Namespace

Drupal\scheduled_updates

Code

public function getLatestRevision($entity_type_id, $entity_id) {
  if ($latest_revision_id = $this
    ->getLatestRevisionId($entity_type_id, $entity_id)) {
    return $this->entityTypeManager
      ->getStorage($entity_type_id)
      ->loadRevision($latest_revision_id);
  }
  return NULL;
}