diff --git a/core/lib/Drupal/Core/Entity/ContentEntityBase.php b/core/lib/Drupal/Core/Entity/ContentEntityBase.php index 3c4182d..0184ad7 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityBase.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityBase.php @@ -164,13 +164,20 @@ public function __construct(array $values, $entity_type, $bundle = FALSE, $trans /** * {@inheritdoc} */ + public function postCreate(EntityStorageControllerInterface $storage_controller) { + $this->newRevision = TRUE; + } + + /** + * {@inheritdoc} + */ public function setNewRevision($value = TRUE) { if (!$this->getEntityType()->getKey('revision')) { throw new \LogicException(String::format('Entity type @entity_type does support revisions.')); } - if ($value) { + 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->set($this->getEntityType()->getKey('revision'), NULL);