You are here

public function MembershipManagerInterface::getGroups in Organic groups 8

Returns all groups that are associated with the given group content entity.

Do not use this to retrieve group memberships for a user entity. Use GroupMembershipInterface::getUserGroups() instead.

The reason there are separate method for group content and user entities is because the storage is handled differently. For group content the relation to the group is stored on a field attached to the content entity, while user memberships are tracked in OgMembership entities.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The group content entity for which to return the groups.

string $group_type_id: Filter results to only include groups of this entity type.

string $group_bundle: Filter results to only include groups of this bundle.

Return value

\Drupal\Core\Entity\EntityInterface[][] An associative array, keyed by group entity type, each item an array of group entities.

See also

\Drupal\og\GroupMembershipInterface::getUserGroups()

1 method overrides MembershipManagerInterface::getGroups()
MembershipManager::getGroups in src/MembershipManager.php
Returns all groups that are associated with the given group content entity.

File

src/MembershipManagerInterface.php, line 233

Class

MembershipManagerInterface
Membership manager interface.

Namespace

Drupal\og

Code

public function getGroups(EntityInterface $entity, $group_type_id = NULL, $group_bundle = NULL);