You are here

public function ModerationInformation::getLatestRevision in Config Entity Revisions 8.2

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 ModerationInformation::getLatestRevision

Deprecated

in drupal:8.8.0 and is removed from drupal:9.0.0. Use RevisionableStorageInterface::getLatestRevisionId and RevisionableStorageInterface::loadRevision instead.

See also

https://www.drupal.org/node/3087295

File

src/ModerationInformation.php, line 100

Class

ModerationInformation
Class ModerationInformation.

Namespace

Drupal\config_entity_revisions

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);
  }
}