Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. EntityOwnerTrait.php

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal