summaryrefslogtreecommitdiffstatshomepage
path: root/core/modules/user/src/EntityOwnerInterface.php
blob: 2144294426a51e7f4b676c4ecf8a65ab0c6492ac (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php

namespace Drupal\user;

/**
 * Defines a common interface for entities that have an owner.
 *
 * An owner is someone who has primary control over an entity, similar to
 * owners in Unix file system access. This may or may not be the entity's
 * original author. The owner may also have less permissions than other users,
 * such as administrators.
 *
 * @ingroup entity_type_characteristics
 */
interface EntityOwnerInterface {

  /**
   * Returns the entity owner's user entity.
   *
   * @return \Drupal\user\UserInterface
   *   The owner user entity.
   */
  public function getOwner();

  /**
   * Sets the entity owner's user entity.
   *
   * @param \Drupal\user\UserInterface $account
   *   The owner user entity.
   *
   * @return $this
   */
  public function setOwner(UserInterface $account);

  /**
   * Returns the entity owner's user ID.
   *
   * @return int|null
   *   The owner user ID, or NULL in case the user ID field has not been set on
   *   the entity.
   */
  public function getOwnerId();

  /**
   * Sets the entity owner's user ID.
   *
   * @param int $uid
   *   The owner user id.
   *
   * @return $this
   */
  public function setOwnerId($uid);

}