public function MembershipManagerInterface::getMembership in Organic groups 8
Returns the group membership for a given user and group.
Parameters
\Drupal\Core\Entity\EntityInterface $group: The group to get the membership for.
int $user_id: The ID of the user to get the membership for.
array $states: (optional) Array with the states to return. Defaults to only returning active memberships. In order to retrieve all memberships regardless of state, pass `OgMembershipInterface::ALL_STATES`.
Return value
\Drupal\og\OgMembershipInterface|null The OgMembership entity. NULL will be returned if no membership is available that matches the passed in $states.
1 method overrides MembershipManagerInterface::getMembership()
- MembershipManager::getMembership in src/
MembershipManager.php - Returns the group membership for a given user and group.
File
- src/
MembershipManagerInterface.php, line 131
Class
- MembershipManagerInterface
- Membership manager interface.
Namespace
Drupal\ogCode
public function getMembership(EntityInterface $group, $user_id, array $states = [
OgMembershipInterface::STATE_ACTIVE,
]);