/** @var \Drupal\Core\Entity\RevisionableStorageInterface $entity_storage */
$entity_storage =
$this->entityTypeManager->
getStorage($entity->
getEntityTypeId());
return static::
ensureVersionExists($entity_storage->
getLatestRevisionId($entity->
id()));
case static::LATEST_VERSION:
// The already loaded revision will be the latest version by default.
// @see \Drupal\Core\Entity\Sql\SqlContentEntityStorage::buildQuery().
return $entity->
getLoadedRevisionId();
default:
$message =
sprintf('The version specifier must be either `%s` or `%s`, `%s` given.',
static::LATEST_VERSION,
static::WORKING_COPY,
$version_argument);
throw new InvalidVersionIdentifierException($message);
} }}