diff --git a/core/lib/Drupal/Core/Entity/EntityStorageBase.php b/core/lib/Drupal/Core/Entity/EntityStorageBase.php index 92ced78..edc9fda 100644 --- a/core/lib/Drupal/Core/Entity/EntityStorageBase.php +++ b/core/lib/Drupal/Core/Entity/EntityStorageBase.php @@ -429,6 +429,7 @@ protected function doPreSave(EntityInterface $entity) { if ($id_exists && !isset($entity->original)) { if (isset($entity->original_revision)) { $entity->original = $this->loadRevision($entity->original_revision); + unset($entity->original_revision); } else { $entity->original = $this->loadUnchanged($id); diff --git a/core/modules/system/tests/modules/entity_test/entity_test.module b/core/modules/system/tests/modules/entity_test/entity_test.module index 453bdf1..241df61 100644 --- a/core/modules/system/tests/modules/entity_test/entity_test.module +++ b/core/modules/system/tests/modules/entity_test/entity_test.module @@ -399,6 +399,13 @@ function entity_test_entity_test_insert($entity) { } /** + * Implements hook_entity_update(). + */ +function entity_test_entity_update(EntityInterface $entity) { + \Drupal::state()->set('entity_test.original', $entity->original); +} + +/** * Implements hook_entity_field_access(). * * @see \Drupal\system\Tests\Entity\FieldAccessTest::testFieldAccess()