diff --git a/core/lib/Drupal/Core/Entity/ContentEntityBase.php b/core/lib/Drupal/Core/Entity/ContentEntityBase.php index 7c0a458..6beb172 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityBase.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityBase.php @@ -266,6 +266,7 @@ public function setNewRevision($value = TRUE) { if ($value && !$this->newRevision) { // When saving a new revision, set any existing revision ID to NULL so as // to ensure that a new revision will actually be created. + $this->original_revision = $this->getRevisionId(); $this->set($this->getEntityType()->getKey('revision'), NULL); // Make sure that the flag tracking which translations are affected by the diff --git a/core/lib/Drupal/Core/Entity/EntityStorageBase.php b/core/lib/Drupal/Core/Entity/EntityStorageBase.php index f583121..92ced78 100644 --- a/core/lib/Drupal/Core/Entity/EntityStorageBase.php +++ b/core/lib/Drupal/Core/Entity/EntityStorageBase.php @@ -427,7 +427,12 @@ protected function doPreSave(EntityInterface $entity) { // Load the original entity, if any. if ($id_exists && !isset($entity->original)) { - $entity->original = $this->loadUnchanged($id); + if (isset($entity->original_revision)) { + $entity->original = $this->loadRevision($entity->original_revision); + } + else { + $entity->original = $this->loadUnchanged($id); + } } // Allow code to run before saving.