You are here

public function OgMembership::getGroup in Organic groups 8

Gets the group associated with the membership.

Return value

\Drupal\Core\Entity\ContentEntityInterface|null The group object which is referenced by the membership, or NULL if the group no longer exists in the entity storage. This can happen when the cleanup of orphaned memberships is configured to be handled in a cron job or batch process.

Overrides OgMembershipInterface::getGroup

4 calls to OgMembership::getGroup()
OgMembership::invalidateTagsOnSave in src/Entity/OgMembership.php
Invalidates an entity's cache tags upon save.
OgMembership::isOwner in src/Entity/OgMembership.php
Returns TRUE if the OG membership belongs to the group owner.
OgMembership::isRoleValid in src/Entity/OgMembership.php
Returns whether the given role is valid for this membership.
OgMembership::preSave in src/Entity/OgMembership.php
Acts on an entity before the presave hook is invoked.

File

src/Entity/OgMembership.php, line 198

Class

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

Namespace

Drupal\og\Entity

Code

public function getGroup() : ?ContentEntityInterface {
  $entity_type = $this
    ->getGroupEntityType();
  $entity_id = $this
    ->getGroupId();
  return \Drupal::entityTypeManager()
    ->getStorage($entity_type)
    ->load($entity_id);
}