public function OgMembership::getGroupId in Organic groups 8
Gets the group entity ID.
Return value
string The entity identifier.
Overrides OgMembershipInterface::getGroupId
1 call to OgMembership::getGroupId()
- OgMembership::getGroup in src/
Entity/ OgMembership.php - Gets the group associated with the membership.
File
- src/
Entity/ OgMembership.php, line 164
Class
- OgMembership
- The membership entity that connects a group and a user.
Namespace
Drupal\og\EntityCode
public function getGroupId() : string {
$entity_id = $this
->getFieldValue('entity_id', 'value') ?: '';
assert(!empty($entity_id), new \LogicException(__METHOD__ . '() should only be called on loaded memberships, or on newly created memberships that already have the group ID set.'));
return $entity_id;
}