protected function loadRevision(EntityInterface
$entity,
$revision_id) { $storage =
$this->entityTypeManager->
getStorage($entity->
getEntityTypeId());
$revision =
static::
ensureVersionExists($storage->
loadRevision($revision_id));
if ($revision->
id() !==
$entity->
id()) { throw new VersionNotFoundException(sprintf('The requested resource does not have a version with ID %s.',
$revision_id));
} return $revision;
} /**
* Helper method that ensures that a version exists.
*
* @param int|\Drupal\Core\Entity\EntityInterface $revision
* A revision ID, or NULL if one was not found.
*
* @return int|\Drupal\Core\Entity\EntityInterface
* A revision or revision ID, if one was found.
*
* @throws \Drupal\jsonapi\Revisions\VersionNotFoundException
* Thrown if the given value is NULL, meaning the requested version was not
* found.
*/