You are here

public function Group::getMembers in Group 8

Same name and namespace in other branches
  1. 2.0.x src/Entity/Group.php \Drupal\group\Entity\Group::getMembers()

Retrieves all group memberships for the group.

Parameters

string|array $roles: (optional) A group role machine name or a list of group role machine names to filter on. Results only need to match on one role (IN query).

Return value

\Drupal\group\GroupMembership[] A list of GroupMembership objects representing the memberships.

Overrides GroupInterface::getMembers

File

src/Entity/Group.php, line 215

Class

Group
Defines the Group entity.

Namespace

Drupal\group\Entity

Code

public function getMembers($roles = NULL) {
  return $this
    ->membershipLoader()
    ->loadByGroup($this, $roles);
}