function EntityOwnerTrait::setOwnerId

Same name in other branches
  1. 8.9.x core/modules/user/src/EntityOwnerTrait.php \Drupal\user\EntityOwnerTrait::setOwnerId()
  2. 10 core/modules/user/src/EntityOwnerTrait.php \Drupal\user\EntityOwnerTrait::setOwnerId()
  3. 11.x core/modules/user/src/EntityOwnerTrait.php \Drupal\user\EntityOwnerTrait::setOwnerId()
1 call to EntityOwnerTrait::setOwnerId()
Media::preSave in core/modules/media/src/Entity/Media.php
Acts on an entity before the presave hook is invoked.

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.