You are here

public function EntityOwnerTrait::setOwnerId in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/user/src/EntityOwnerTrait.php \Drupal\user\EntityOwnerTrait::setOwnerId()

File

core/modules/user/src/EntityOwnerTrait.php, line 55

Class

EntityOwnerTrait
Provides a trait for entities that have an owner.

Namespace

Drupal\user

Code

public function setOwnerId($uid) {
  $key = $this
    ->getEntityType()
    ->getKey('owner');
  $this
    ->set($key, $uid);
  return $this;
}