diff --git a/core/lib/Drupal/Core/Entity/ContentEntityBase.php b/core/lib/Drupal/Core/Entity/ContentEntityBase.php index 7d5d669..59a3020 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityBase.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityBase.php @@ -1370,8 +1370,10 @@ public function isLatestRevision() { if ($this->isNew() || !$this->getEntityType()->isRevisionable()) { return TRUE; } - $storage = $this->entityTypeManager()->getStorage($this->getEntityTypeId()); - $result = $storage->getQuery() + + $result = $this->entityTypeManager() + ->getStorage($this->getEntityTypeId()) + ->getQuery() ->latestRevision() ->condition($this->getEntityType()->getKey('id'), $this->id()) ->execute(); diff --git a/core/lib/Drupal/Core/Entity/EntityRepository.php b/core/lib/Drupal/Core/Entity/EntityRepository.php index 4e9ad7f..af56187 100644 --- a/core/lib/Drupal/Core/Entity/EntityRepository.php +++ b/core/lib/Drupal/Core/Entity/EntityRepository.php @@ -85,7 +85,7 @@ public function loadLatestEntityRevision($entity_type_id, $entity_id) { if ($definition->isRevisionable()) { $result = $storage->getQuery() ->latestRevision() - ->condition($this->entityTypeManager->getDefinition($entity_type_id)->getKey('id'), $entity_id) + ->condition($definition->getKey('id'), $entity_id) ->execute(); if ($result) { $latest_revision_id = key($result);