protected function EntityRepository::loadRevision in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Entity/EntityRepository.php \Drupal\Core\Entity\EntityRepository::loadRevision()
Loads the specified entity revision.
Parameters
\Drupal\Core\Entity\RevisionableInterface $entity: The default revision of the entity being converted.
string $revision_id: The identifier of the revision to be loaded.
Return value
\Drupal\Core\Entity\RevisionableInterface An entity revision object.
1 call to EntityRepository::loadRevision()
- EntityRepository::getLatestTranslationAffectedRevision in core/
lib/ Drupal/ Core/ Entity/ EntityRepository.php - Returns the latest revision translation of the specified entity.
File
- core/
lib/ Drupal/ Core/ Entity/ EntityRepository.php, line 289
Class
- EntityRepository
- Provides several mechanisms for retrieving entities.
Namespace
Drupal\Core\EntityCode
protected function loadRevision(RevisionableInterface $entity, $revision_id) {
// We explicitly perform a loose equality check, since a revision ID may be
// returned as an integer or a string.
if ($entity
->getLoadedRevisionId() != $revision_id) {
/** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */
$storage = $this->entityTypeManager
->getStorage($entity
->getEntityTypeId());
return $storage
->loadRevision($revision_id);
}
return $entity;
}