EntityOwnerInterface.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace Drupal\user;
  3. /**
  4. * Defines a common interface for entities that have an owner.
  5. *
  6. * An owner is someone who has primary control over an entity, similar to
  7. * owners in Unix file system access. This may or may not be the entity's
  8. * original author. The owner may also have less permissions than other users,
  9. * such as administrators.
  10. */
  11. interface EntityOwnerInterface {
  12. /**
  13. * Returns the entity owner's user entity.
  14. *
  15. * @return \Drupal\user\UserInterface
  16. * The owner user entity.
  17. */
  18. public function getOwner();
  19. /**
  20. * Sets the entity owner's user entity.
  21. *
  22. * @param \Drupal\user\UserInterface $account
  23. * The owner user entity.
  24. *
  25. * @return $this
  26. */
  27. public function setOwner(UserInterface $account);
  28. /**
  29. * Returns the entity owner's user ID.
  30. *
  31. * @return int|null
  32. * The owner user ID, or NULL in case the user ID field has not been set on
  33. * the entity.
  34. */
  35. public function getOwnerId();
  36. /**
  37. * Sets the entity owner's user ID.
  38. *
  39. * @param int $uid
  40. * The owner user id.
  41. *
  42. * @return $this
  43. */
  44. public function setOwnerId($uid);
  45. }