Commit 4b4ef377 authored by catch's avatar catch

Issue #2078387 by Xano, andypost, twistor, splatio, InternetDevels, amateescu,...

Issue #2078387 by Xano, andypost, twistor, splatio, InternetDevels, amateescu, Berdir, larowlan, vladan.me: Add an EntityOwnerInterface.
parent 2dc655fe
......@@ -18,6 +18,7 @@
use Drupal\field\FieldInstanceInterface;
use Drupal\field\FieldInterface;
use Drupal\file\FileInterface;
use Drupal\user\EntityOwnerInterface;
/**
* Comments are displayed in a flat list - expanded.
......@@ -932,18 +933,22 @@ function comment_entity_insert(EntityInterface $entity) {
'last_comment_uid',
'comment_count'
));
$execute_query = FALSE;
foreach ($fields as $field_name => $detail) {
// Skip fields that entity does not have.
if (!$entity->hasField($field_name)) {
continue;
}
// There is at least one comment field, the query needs to be executed.
// @todo Use $entity->getAuthorId() after https://drupal.org/node/2078387
if ($entity->hasField('uid')) {
$last_comment_uid = $entity->get('uid')->value;
$execute_query = TRUE;
// Get the user ID from the entity if it is set, or default to the
// currently logged in user.
if ($entity instanceof EntityOwnerInterface) {
$last_comment_uid = $entity->getOwnerId();
}
else {
// Default to current user when entity does not have a uid property.
if (!isset($last_comment_uid)) {
// Default to current user when entity does not implement
// EntityOwnerInterface or author is not set.
$last_comment_uid = \Drupal::currentUser()->id();
}
// Default to REQUEST_TIME when entity does not have a changed property.
......@@ -962,7 +967,9 @@ function comment_entity_insert(EntityInterface $entity) {
'comment_count' => 0,
));
}
$query->execute();
if ($execute_query) {
$query->execute();
}
}
}
......@@ -1088,9 +1095,10 @@ function comment_user_cancel($edit, $account, $method) {
break;
case 'user_cancel_reassign':
/** @var \Drupal\comment\CommentInterface[] $comments */
$comments = entity_load_multiple_by_properties('comment', array('uid' => $account->id()));
foreach ($comments as $comment) {
$comment->uid->target_id = 0;
$comment->setOwnerId(0);
$comment->save();
}
break;
......@@ -1284,7 +1292,7 @@ function comment_preview(CommentInterface $comment, array &$form_state) {
}
if (!empty($account) && $account->isAuthenticated()) {
$comment->uid->target_id = $account->id();
$comment->setOwner($account);
$comment->name->value = check_plain($account->getUsername());
}
else {
......@@ -1355,7 +1363,7 @@ function comment_preprocess_block(&$variables) {
*/
function comment_prepare_author(CommentInterface $comment) {
// The account has been pre-loaded by CommentViewBuilder::buildContent().
$account = $comment->uid->entity;
$account = $comment->getOwner();
if (empty($account->uid->value)) {
$account = entity_create('user', array('uid' => 0, 'name' => $comment->name->value, 'homepage' => $comment->homepage->value));
}
......@@ -1373,7 +1381,7 @@ function comment_prepare_author(CommentInterface $comment) {
* Array keys: #comment, #commented_entity.
*/
function template_preprocess_comment(&$variables) {
/** @var $comment \Drupal\comment\CommentInterface */
/** @var \Drupal\comment\CommentInterface $comment */
$comment = $variables['elements']['#comment'];
$commented_entity = entity_load($comment->entity_type->value, $comment->entity_id->value);
$variables['comment'] = $comment;
......@@ -1481,12 +1489,12 @@ function template_preprocess_comment(&$variables) {
if ($variables['status'] != 'published') {
$variables['attributes']['class'][] = $variables['status'];
}
if (!$comment->uid->target_id) {
if (!$comment->getOwnerId()) {
$variables['attributes']['class'][] = 'by-anonymous';
}
else {
// @todo Use $entity->getAuthorId() after https://drupal.org/node/2078387
if ($commented_entity->hasField('uid') && $comment->uid->target_id == $commented_entity->get('uid')->value) {
if ($commented_entity instanceof EntityOwnerInterface && $comment->getOwnerId() == $commented_entity->getOwnerId()) {
$variables['attributes']['class'][] = 'by-' . $commented_entity->getEntityTypeId() . '-author';
}
}
......@@ -1494,7 +1502,7 @@ function template_preprocess_comment(&$variables) {
$variables['attributes']['class'][] = 'clearfix';
// Add comment author user ID. Necessary for the comment-by-viewer library.
$variables['attributes']['data-comment-user-id'] = $comment->uid->value;
$variables['attributes']['data-comment-user-id'] = $comment->getOwnerId();
$variables['content_attributes']['class'][] = 'content';
}
......
......@@ -127,6 +127,7 @@ function comment_tokens($type, $tokens, array $data = array(), array $options =
$replacements = array();
if ($type == 'comment' && !empty($data['comment'])) {
/** @var \Drupal\comment\CommentInterface $comment */
$comment = $data['comment'];
foreach ($tokens as $name => $original) {
......@@ -142,13 +143,13 @@ function comment_tokens($type, $tokens, array $data = array(), array $options =
break;
case 'name':
$name = ($comment->uid->target_id == 0) ? \Drupal::config('user.settings')->get('anonymous') : $comment->name->value;
$name = ($comment->getOwnerId() == 0) ? \Drupal::config('user.settings')->get('anonymous') : $comment->name->value;
$replacements[$original] = $sanitize ? filter_xss($name) : $name;
break;
case 'mail':
if ($comment->uid->target_id != 0) {
$mail = $comment->uid->entity->getEmail();
if ($comment->getOwnerId()) {
$mail = $comment->getOwner()->getEmail();
}
else {
$mail = $comment->mail->value;
......@@ -244,7 +245,7 @@ function comment_tokens($type, $tokens, array $data = array(), array $options =
$replacements += $token_service->generate('comment', $parent_tokens, array('comment' => $parent), $options);
}
if (($author_tokens = $token_service->findwithPrefix($tokens, 'author')) && $account = $comment->uid->entity) {
if (($author_tokens = $token_service->findwithPrefix($tokens, 'author')) && $account = $comment->getOwner()) {
$replacements += $token_service->generate('user', $author_tokens, array('user' => $account), $options);
}
}
......
......@@ -22,13 +22,14 @@ class CommentAccessController extends EntityAccessController {
* {@inheritdoc}
*/
protected function checkAccess(EntityInterface $entity, $operation, $langcode, AccountInterface $account) {
/** @var \Drupal\Core\Entity\EntityInterface|\Drupal\user\EntityOwnerInterface $entity */
switch ($operation) {
case 'view':
return user_access('access comments', $account);
break;
case 'update':
return ($account->id() && $account->id() == $entity->uid->value && $entity->status->value == CommentInterface::PUBLISHED && user_access('edit own comments', $account)) || user_access('administer comments', $account);
return ($account->id() && $account->id() == $entity->getOwnerId() && $entity->status->value == CommentInterface::PUBLISHED && user_access('edit own comments', $account)) || user_access('administer comments', $account);
break;
case 'delete':
......
......@@ -77,6 +77,7 @@ protected function init(array &$form_state) {
* Overrides Drupal\Core\Entity\EntityFormController::form().
*/
public function form(array $form, array &$form_state) {
/** @var \Drupal\comment\CommentInterface $comment */
$comment = $this->entity;
$entity = $this->entityManager->getStorageController($comment->entity_type->value)->load($comment->entity_id->value);
$field_name = $comment->field_name->value;
......@@ -212,7 +213,7 @@ public function form(array $form, array &$form_state) {
// Used for conditional validation of author fields.
$form['is_anonymous'] = array(
'#type' => 'value',
'#value' => ($comment->id() ? !$comment->uid->target_id : $this->currentUser->isAnonymous()),
'#value' => ($comment->id() ? !$comment->getOwnerId() : $this->currentUser->isAnonymous()),
);
// Add internal comment properties.
......@@ -313,13 +314,14 @@ public function buildEntity(array $form, array &$form_state) {
* Overrides Drupal\Core\Entity\EntityFormController::submit().
*/
public function submit(array $form, array &$form_state) {
/** @var \Drupal\comment\CommentInterface $comment */
$comment = parent::submit($form, $form_state);
// If the comment was posted by a registered user, assign the author's ID.
// @todo Too fragile. Should be prepared and stored in comment_form()
// already.
if (!$comment->is_anonymous && !empty($comment->name->value) && ($account = user_load_by_name($comment->name->value))) {
$comment->uid->target_id = $account->id();
$comment->setOwner($account);
}
// If the comment was posted by an anonymous user and no author name was
// required, use "Anonymous" by default.
......
......@@ -8,12 +8,13 @@
namespace Drupal\comment;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\user\EntityOwnerInterface;
use Drupal\Core\Entity\EntityChangedInterface;
/**
* Provides an interface defining a comment entity.
*/
interface CommentInterface extends ContentEntityInterface, EntityChangedInterface {
interface CommentInterface extends ContentEntityInterface, EntityChangedInterface, EntityOwnerInterface {
/**
* Comment is awaiting approval.
......
......@@ -10,6 +10,7 @@
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\FieldableDatabaseStorageController;
use Drupal\Core\Entity\EntityChangedInterface;
use Drupal\user\EntityOwnerInterface;
/**
* Defines the controller class for comments.
......@@ -92,6 +93,16 @@ public function updateEntityStatistics(CommentInterface $comment) {
else {
// Comments do not exist.
$entity = entity_load($comment->entity_type->value, $comment->entity_id->value);
// Get the user ID from the entity if it's set, or default to the
// currently logged in user.
if ($entity instanceof EntityOwnerInterface) {
$last_comment_uid = $entity->getOwnerId();
}
if (!isset($last_comment_uid)) {
// Default to current user when entity does not implement
// EntityOwnerInterface or author is not set.
$last_comment_uid = \Drupal::currentUser()->id();
}
$this->database->update('comment_entity_statistics')
->fields(array(
'cid' => 0,
......@@ -100,10 +111,7 @@ public function updateEntityStatistics(CommentInterface $comment) {
// REQUEST_TIME.
'last_comment_timestamp' => ($entity instanceof EntityChangedInterface) ? $entity->getChangedTime() : REQUEST_TIME,
'last_comment_name' => '',
// @todo Use $entity->getAuthorId() after https://drupal.org/node/2078387
// Get the user ID from the entity if it's set, or default to the
// currently logged in user.
'last_comment_uid' => $entity->hasField('uid') ? $entity->get('uid')->value : \Drupal::currentUser()->id(),
'last_comment_uid' => $last_comment_uid,
))
->condition('entity_id', $comment->entity_id->value)
->condition('entity_type', $comment->entity_type->value)
......
......@@ -94,7 +94,7 @@ public function buildContent(array $entities, array $displays, $view_mode, $lang
// Pre-load associated users into cache to leverage multiple loading.
$uids = array();
foreach ($entities as $entity) {
$uids[] = $entity->uid->target_id;
$uids[] = $entity->getOwnerId();
}
$this->entityManager->getStorageController('user')->loadMultiple(array_unique($uids));
......
......@@ -14,6 +14,7 @@
use Drupal\Core\Field\FieldDefinition;
use Drupal\Core\Language\Language;
use Drupal\Core\TypedData\DataDefinition;
use Drupal\user\UserInterface;
/**
* Defines the comment entity class.
......@@ -291,7 +292,7 @@ public function preSave(EntityStorageControllerInterface $storage_controller) {
}
// We test the value with '===' because we need to modify anonymous
// users as well.
if ($this->uid->target_id === \Drupal::currentUser()->id() && \Drupal::currentUser()->isAuthenticated()) {
if ($this->getOwnerId() === \Drupal::currentUser()->id() && \Drupal::currentUser()->isAuthenticated()) {
$this->name->value = \Drupal::currentUser()->getUsername();
}
// Add the values which aren't passed into the function.
......@@ -464,4 +465,34 @@ public static function preCreate(EntityStorageControllerInterface $storage_contr
}
}
/**
* {@inheritdoc}
*/
public function getOwner() {
return $this->get('uid')->entity;
}
/**
* {@inheritdoc}
*/
public function getOwnerId() {
return $this->get('uid')->target_id;
}
/**
* {@inheritdoc}
*/
public function setOwnerId($uid) {
$this->set('uid', $uid);
return $this;
}
/**
* {@inheritdoc}
*/
public function setOwner(UserInterface $account) {
$this->set('uid', $account->id());
return $this;
}
}
......@@ -80,7 +80,7 @@ function testCommentInterface() {
// Test changing the comment author to "Anonymous".
$comment = $this->postComment(NULL, $comment->comment_body->value, $comment->subject->value, array('name' => ''));
$this->assertTrue(empty($comment->name->value) && $comment->uid->target_id == 0, 'Comment author successfully changed to anonymous.');
$this->assertTrue(empty($comment->name->value) && $comment->getOwnerId() == 0, 'Comment author successfully changed to anonymous.');
// Test changing the comment author to an unverified user.
$random_name = $this->randomName();
......@@ -92,7 +92,7 @@ function testCommentInterface() {
// Test changing the comment author to a verified user.
$this->drupalGet('comment/' . $comment->id() . '/edit');
$comment = $this->postComment(NULL, $comment->comment_body->value, $comment->subject->value, array('name' => $this->web_user->getUsername()));
$this->assertTrue($comment->name->value == $this->web_user->getUsername() && $comment->uid->target_id == $this->web_user->id(), 'Comment author successfully changed to a registered user.');
$this->assertTrue($comment->name->value == $this->web_user->getUsername() && $comment->getOwnerId() == $this->web_user->id(), 'Comment author successfully changed to a registered user.');
$this->drupalLogout();
......
......@@ -48,7 +48,7 @@ function setUp() {
));
// Set the author of the created node to the web_user uid.
$this->node->setAuthorId($this->web_user->id())->save();
$this->node->setOwnerId($this->web_user->id())->save();
}
/**
......
......@@ -67,7 +67,7 @@ function testCommentTokenReplacement() {
$tests['[comment:parent:title]'] = check_plain($parent_comment->subject->value);
$tests['[comment:node:nid]'] = $comment->entity_id->value;
$tests['[comment:node:title]'] = check_plain($node->getTitle());
$tests['[comment:author:uid]'] = $comment->uid->target_id;
$tests['[comment:author:uid]'] = $comment->getOwnerId();
$tests['[comment:author:name]'] = check_plain($this->admin_user->getUsername());
// Test to make sure that we generated something for each token.
......
......@@ -108,7 +108,7 @@ protected function createEntity($values, $langcode, $node_bundle = 'node__commen
$values['entity_id'] = $node->id();
$values['entity_type'] = 'node';
$values['field_id'] = $node_bundle;
$values['uid'] = $node->getAuthorId();
$values['uid'] = $node->getOwnerId();
return parent::createEntity($values, $langcode, $node_bundle);
}
......
......@@ -82,13 +82,14 @@ public function setUp() {
// Create some comments and attach them to the created node.
for ($i = 0; $i < $this->masterDisplayResults; $i++) {
/** @var \Drupal\comment\CommentInterface $comment */
$comment = entity_create('comment', array(
'status' => CommentInterface::PUBLISHED,
'field_name' => 'comment',
'entity_type' => 'node',
'entity_id' => $this->node->id(),
));
$comment->uid->target_id = 0;
$comment->setOwnerId(0);
$comment->subject->value = 'Test comment ' . $i;
$comment->comment_body->value = 'Test body ' . $i;
$comment->comment_body->format = 'full_html';
......
......@@ -9,6 +9,7 @@
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\WidgetBase;
use Drupal\user\EntityOwnerInterface;
use Symfony\Component\Validator\ConstraintViolationInterface;
/**
......@@ -94,8 +95,7 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen
'#size' => $this->getSetting('size'),
'#placeholder' => $this->getSetting('placeholder'),
'#element_validate' => array(array($this, 'elementValidate')),
// @todo: Use wrapper to get the user if exists or needed.
'#autocreate_uid' => isset($entity->uid) ? $entity->uid : $user->id(),
'#autocreate_uid' => ($entity instanceof EntityOwnerInterface) ? $entity->getOwnerId() : $user->id(),
);
return array('target_id' => $element);
......@@ -187,11 +187,16 @@ protected function createNewEntity($label, $uid) {
$bundle_key = $entity_info->getKey('bundle');
$label_key = $entity_info->getKey('label');
return $entity_manager->getStorageController($target_type)->create(array(
$entity = $entity_manager->getStorageController($target_type)->create(array(
$label_key => $label,
$bundle_key => $bundle,
'uid' => $uid,
));
if ($entity instanceof EntityOwnerInterface) {
$entity->setOwnerId($uid);
}
return $entity;
}
/**
......
......@@ -602,6 +602,7 @@ function file_file_download($uri, $field_type = 'file') {
$user = \Drupal::currentUser();
// Get the file record based on the URI. If not in the database just return.
/** @var \Drupal\file\FileInterface[] $files */
$files = entity_load_multiple_by_properties('file', array('uri' => $uri));
if (count($files)) {
foreach ($files as $item) {
......@@ -625,7 +626,7 @@ function file_file_download($uri, $field_type = 'file') {
// temporary files where the host entity has not yet been saved (for example,
// an image preview on a node/add form) in which case, allow download by the
// file's owner.
if (empty($references) && ($file->isPermanent() || $file->getOwner()->id() != $user->id())) {
if (empty($references) && ($file->isPermanent() || $file->getOwnerId() != $user->id())) {
return;
}
......@@ -1005,6 +1006,7 @@ function file_tokens($type, $tokens, array $data = array(), array $options = arr
$replacements = array();
if ($type == 'file' && !empty($data['file'])) {
/** @var \Drupal\file\FileInterface $file */
$file = $data['file'];
foreach ($tokens as $name => $original) {
......
......@@ -132,8 +132,24 @@ public function getOwner() {
/**
* {@inheritdoc}
*/
public function setOwner(UserInterface $user) {
return $this->get('uid')->entity = $user;
public function getOwnerId() {
return $this->get('uid')->target_id;
}
/**
* {@inheritdoc}
*/
public function setOwnerId($uid) {
$this->set('uid', $uid);
return $this;
}
/**
* {@inheritdoc}
*/
public function setOwner(UserInterface $account) {
$this->set('uid', $account->id());
return $this;
}
/**
......
......@@ -8,13 +8,14 @@
namespace Drupal\file;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\user\EntityOwnerInterface;
use Drupal\Core\Entity\EntityChangedInterface;
use Drupal\user\UserInterface;
/**
* Defines getter and setter methods for file entity base fields.
*/
interface FileInterface extends ContentEntityInterface, EntityChangedInterface {
interface FileInterface extends ContentEntityInterface, EntityChangedInterface, EntityOwnerInterface {
/**
* Returns the name of the file.
......@@ -111,22 +112,6 @@ public function setPermanent();
*/
public function setTemporary();
/**
* Returns the user that owns this file.
*
* @return \Drupal\user\UserInterface
* The user that owns the file.
*/
public function getOwner();
/**
* Sets the user that owns this file.
*
* @param \Drupal\user\UserInterface $user
* The user that owns the file.
*/
public function setOwner(UserInterface $user);
/**
* Returns the node creation timestamp.
*
......
......@@ -58,7 +58,7 @@ function testFileTokenReplacement() {
$tests['[file:changed]'] = format_date($file->getChangedTime(), 'medium', '', NULL, $language_interface->id);
$tests['[file:changed:short]'] = format_date($file->getChangedTime(), 'short', '', NULL, $language_interface->id);
$tests['[file:owner]'] = check_plain(user_format_name($this->admin_user));
$tests['[file:owner:uid]'] = $file->getOwner()->id();
$tests['[file:owner:uid]'] = $file->getOwnerId();
// Test to make sure that we generated something for each token.
$this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.');
......
......@@ -762,6 +762,7 @@ function template_preprocess_forum_topic_list(&$variables) {
if (!empty($variables['topics'])) {
$row = 0;
/** @var \Drupal\node\NodeInterface $topic */
foreach ($variables['topics'] as $id => $topic) {
$variables['topics'][$id]->icon = array(
'#theme' => 'forum_icon',
......@@ -788,8 +789,8 @@ function template_preprocess_forum_topic_list(&$variables) {
$variables['topics'][$id]->message = '';
}
$forum_submitted = array('#theme' => 'forum_submitted', '#topic' => (object) array(
'uid' => $topic->getAuthorId(),
'name' => $topic->getAuthor()->getUsername(),
'uid' => $topic->getOwnerId(),
'name' => $topic->getOwner()->getUsername(),
'created' => $topic->getCreatedTime(),
));
$variables['topics'][$id]->submitted = drupal_render($forum_submitted);
......
......@@ -13,6 +13,7 @@
use Drupal\Core\Language\Language;
use Drupal\Core\Session\AccountInterface;
use Drupal\node\NodeInterface;
use Drupal\user\UserInterface;
/**
* Defines the node entity class.
......@@ -292,25 +293,33 @@ public function setPublished($published) {
/**
* {@inheritdoc}
*/
public function getAuthor() {
public function getOwner() {
return $this->get('uid')->entity;
}
/**
* {@inheritdoc}
*/
public function getAuthorId() {
public function getOwnerId() {
return $this->get('uid')->target_id;
}
/**
* {@inheritdoc}
*/
public function setAuthorId($uid) {
public function setOwnerId($uid) {
$this->set('uid', $uid);
return $this;
}
/**
* {@inheritdoc}
*/
public function setOwner(UserInterface $account) {
$this->set('uid', $account->id());
return $this;
}
/**
* {@inheritdoc}
*/
......
......@@ -90,7 +90,9 @@ public function createAccess($entity_bundle = NULL, AccountInterface $account =
protected function checkAccess(EntityInterface $node, $operation, $langcode, AccountInterface $account) {
// Fetch information from the node object if possible.
$status = $node->getTranslation($langcode)->isPublished();
$uid = $node->getTranslation($langcode)->getAuthorId();
/** @var \Drupal\node\NodeInterface $translation */
$translation = $node->getTranslation($langcode);
$uid = $translation->getOwnerId();
// Check if authors can view their own unpublished nodes.
if ($operation === 'view' && !$status && user_access('view own unpublished content', $account)) {
......
......@@ -29,6 +29,7 @@ class NodeFormController extends ContentEntityFormController {
* {@inheritdoc}
*/
protected function prepareEntity() {
/** @var \Drupal\node\NodeInterface $node */
$node = $this->entity;
// Set up default values, if required.
$type = entity_load('node_type', $node->bundle());
......@@ -47,7 +48,7 @@ protected function prepareEntity() {
$node->$key = (int) !empty($this->settings['options'][$key]);
}
}
$node->setAuthorId(\Drupal::currentUser()->id());
$node->setOwnerId(\Drupal::currentUser()->id());
$node->setCreatedTime(REQUEST_TIME);
}
else {
......@@ -63,6 +64,7 @@ protected function prepareEntity() {
* Overrides Drupal\Core\Entity\EntityFormController::form().
*/
public function form(array $form, array &$form_state) {
/** @var \Drupal\node\NodeInterface $node */
$node = $this->entity;
if ($this->operation == 'edit') {
......@@ -180,7 +182,7 @@ public function form(array $form, array &$form_state) {
'#title' => t('Authored by'),
'#maxlength' => 60,
'#autocomplete_route_name' => 'user.autocomplete',
'#default_value' => $node->getAuthorId()? $node->getAuthor()->getUsername() : '',
'#default_value' => $node->getOwnerId()? $node->getOwner()->getUsername() : '',
'#weight' => -1,
'#description' => t('Leave blank for %anonymous.', array('%anonymous' => $user_config->get('anonymous'))),
);
......@@ -417,14 +419,15 @@ public function unpublish(array $form, array &$form_state) {
* {@inheritdoc}
*/
public function buildEntity(array $form, array &$form_state) {
/** @var \Drupal\node\NodeInterface $entity */
$entity = parent::buildEntity($form, $form_state);
// A user might assign the node author by entering a user name in the node
// form, which we then need to translate to a user ID.
if (!empty($form_state['values']['name']) && $account = user_load_by_name($form_state['values']['name'])) {
$entity->setAuthorId($account->id());
$entity->setOwnerId($account->id());
}
else {
$entity->setAuthorId(0);
$entity->setOwnerId(0);
}
if (!empty($form_state['values']['date']) && $form_state['values']['date'] instanceOf DrupalDateTime) {
......
......@@ -7,6 +7,7 @@
namespace Drupal\node;
use Drupal\user\EntityOwnerInterface;
use Drupal\Core\Entity\EntityChangedInterface;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\user\UserInterface;
......@@ -14,7 +15,7 @@
/**
* Provides an interface defining a node entity.
*/
interface NodeInterface extends ContentEntityInterface, EntityChangedInterface {
interface NodeInterface extends ContentEntityInterface, EntityChangedInterface, EntityOwnerInterface {
/**
* Returns the node type.
......@@ -25,7 +26,6 @@ interface NodeInterface extends ContentEntityInterface, EntityChangedInterface {
public function getType();
/**
*
* Returns the node title.
*
* @return string
......@@ -101,33 +101,6 @@ public function isSticky();
*/
public function setSticky($sticky);
/**
* Returns the node author user entity.
*
* @return \Drupal\user\UserInterface
* The author user entity.
*/