diff --git a/core/modules/node/src/Entity/Node.php b/core/modules/node/src/Entity/Node.php index fa6b5a3..0fb327d 100644 --- a/core/modules/node/src/Entity/Node.php +++ b/core/modules/node/src/Entity/Node.php @@ -311,6 +311,13 @@ public function setRevisionCreationTime($timestamp) { * {@inheritdoc} */ public function getRevisionAuthor() { + return $this->getRevisionUser(); + } + + /** + * {@inheritdoc} + */ + public function getRevisionUser() { return $this->get('revision_uid')->entity; } @@ -318,7 +325,45 @@ public function getRevisionAuthor() { * {@inheritdoc} */ public function setRevisionAuthorId($uid) { - $this->set('revision_uid', $uid); + $this->setRevisionUserId($uid); + return $this; + } + + /** + * {@inheritdoc} + */ + public function setRevisionUser(UserInterface $user) { + $this->set('revision_uid', $user); + return $this; + } + + /** + * {@inheritdoc} + */ + public function getRevisionUserId() { + return $this->get('revision_uid')->entity->id(); + } + + /** + * {@inheritdoc} + */ + public function setRevisionUserId($user_id) { + $this->set('revision_uid', $user_id); + return $this; + } + + /** + * {@inheritdoc} + */ + public function getRevisionLogMessage() { + return $this->get('revision_log')->value; + } + + /** + * {@inheritdoc} + */ + public function setRevisionLogMessage($revision_log_message) { + $this->set('revision_log', $revision_log_message); return $this; } diff --git a/core/modules/node/src/NodeInterface.php b/core/modules/node/src/NodeInterface.php index 654c00e..46fd77c 100644 --- a/core/modules/node/src/NodeInterface.php +++ b/core/modules/node/src/NodeInterface.php @@ -2,6 +2,7 @@ namespace Drupal\node; +use Drupal\Core\Entity\RevisionLogInterface; use Drupal\user\EntityOwnerInterface; use Drupal\Core\Entity\EntityChangedInterface; use Drupal\Core\Entity\ContentEntityInterface; @@ -9,7 +10,7 @@ /** * Provides an interface defining a node entity. */ -interface NodeInterface extends ContentEntityInterface, EntityChangedInterface, EntityOwnerInterface { +interface NodeInterface extends ContentEntityInterface, EntityChangedInterface, EntityOwnerInterface, RevisionLogInterface { /** * Gets the node type. @@ -140,6 +141,9 @@ public function setRevisionCreationTime($timestamp); * * @return \Drupal\user\UserInterface * The user entity for the revision author. + * + * @deprecated in Drupal 8.2.0, will be removed before Drupal 9.0.0. + * Use getRevisionUser() instead. */ public function getRevisionAuthor(); @@ -151,6 +155,9 @@ public function getRevisionAuthor(); * * @return \Drupal\node\NodeInterface * The called node entity. + * + * @deprecated in Drupal 8.2.0, will be removed before Drupal 9.0.0. + * Use setRevisionUserId() instead. */ public function setRevisionAuthorId($uid);