You are here

public function File::setOwner in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/file/src/Entity/File.php \Drupal\file\Entity\File::setOwner()

Sets the entity owner's user entity.

Parameters

\Drupal\user\UserInterface $account: The owner user entity.

Return value

$this

Overrides EntityOwnerInterface::setOwner

File

core/modules/file/src/Entity/File.php, line 138
Contains \Drupal\file\Entity\File.

Class

File
Defines the file entity class.

Namespace

Drupal\file\Entity

Code

public function setOwner(UserInterface $account) {
  $this
    ->set('uid', $account
    ->id());
  return $this;
}