You are here

public function OgMembership::getOwnerId in Organic groups 8

Returns the entity owner's user ID.

Return value

int|null The owner user ID, or NULL in case the user ID field has not been set on the entity.

Overrides EntityOwnerInterface::getOwnerId

1 call to OgMembership::getOwnerId()
OgMembership::isOwner in src/Entity/OgMembership.php
Returns TRUE if the OG membership belongs to the group owner.

File

src/Entity/OgMembership.php, line 111

Class

OgMembership
The membership entity that connects a group and a user.

Namespace

Drupal\og\Entity

Code

public function getOwnerId() {
  $owner_id = $this
    ->getFieldValue('uid', 'target_id');
  assert(!empty($owner_id), new \LogicException(__METHOD__ . '() should only be called on loaded memberships, or on newly created memberships that already have the owner set.'));
  return $owner_id;
}