00a8328763575de135f5cd8ae0ce6254f658a7c3 core/modules/entity/lib/Drupal/entity/Entity.php | 8 ++++++-- core/modules/entity/lib/Drupal/entity/EntityInterface.php | 8 ++++++-- core/modules/node/lib/Drupal/node/NodeStorageController.php | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/core/modules/entity/lib/Drupal/entity/Entity.php b/core/modules/entity/lib/Drupal/entity/Entity.php index a9acf36..e49ca95 100644 --- a/core/modules/entity/lib/Drupal/entity/Entity.php +++ b/core/modules/entity/lib/Drupal/entity/Entity.php @@ -266,8 +266,12 @@ public function getRevisionId() { /** * Implements Drupal\entity\EntityInterface::isCurrentRevision(). */ - public function isCurrentRevision() { - return $this->isCurrentRevision; + public function isCurrentRevision($new_value = NULL) { + $return = $this->isCurrentRevision; + if (isset($new_value)) { + $this->isCurrentRevision = (bool) $new_value; + } + return $return; } } diff --git a/core/modules/entity/lib/Drupal/entity/EntityInterface.php b/core/modules/entity/lib/Drupal/entity/EntityInterface.php index 699c424..0b89e12 100644 --- a/core/modules/entity/lib/Drupal/entity/EntityInterface.php +++ b/core/modules/entity/lib/Drupal/entity/EntityInterface.php @@ -200,9 +200,13 @@ public function getRevisionId(); /** * Checks if this entity is the current revision. * + * @param bool $new_value + * (optional) A Boolean to (re)set the isCurrentRevision flag. + * * @return bool - * TRUE if the entity is the current revision, FALSE otherwise. + * TRUE if the entity is the current revision, FALSE otherwise. If + * $new_value was passed, the previous value is returned. */ - public function isCurrentRevision(); + public function isCurrentRevision($new_value = NULL); } diff --git a/core/modules/node/lib/Drupal/node/NodeStorageController.php b/core/modules/node/lib/Drupal/node/NodeStorageController.php index 0fa7b33..d082d1e 100644 --- a/core/modules/node/lib/Drupal/node/NodeStorageController.php +++ b/core/modules/node/lib/Drupal/node/NodeStorageController.php @@ -151,7 +151,7 @@ protected function saveRevision(EntityInterface $entity) { $entity->{$this->revisionKey} = $record->{$this->revisionKey}; // Mark this revision as the current one. - $entity->isCurrentRevision = TRUE; + $entity->isCurrentRevision(TRUE); } /**