You are here

public function TeamMembershipManager::getTeams in Apigee Edge 8

Same name in this branch
  1. 8 modules/apigee_edge_teams/src/TeamMembershipManager.php \Drupal\apigee_edge_teams\TeamMembershipManager::getTeams()
  2. 8 modules/apigee_edge_actions/src/TeamMembershipManager.php \Drupal\apigee_edge_actions\TeamMembershipManager::getTeams()

Returns the list of teams where the developer is currently a member.

Parameters

string $developer: Developer email address.

Return value

string[] Array of team names.

Throws

\Drupal\apigee_edge\Exception\DeveloperDoesNotExistException If developer not found with id.

Overrides TeamMembershipManagerInterface::getTeams

File

modules/apigee_edge_teams/src/TeamMembershipManager.php, line 166

Class

TeamMembershipManager
Service that makes easier to work with company (team) memberships.

Namespace

Drupal\apigee_edge_teams

Code

public function getTeams(string $developer) : array {

  /** @var \Drupal\apigee_edge\Entity\DeveloperInterface $entity */
  $entity = $this->entityTypeManager
    ->getStorage('developer')
    ->load($developer);
  if ($entity === NULL) {
    throw new DeveloperDoesNotExistException($developer);
  }

  // Developer entity's getCompanies() method should return the list of
  // companies where the developer is member.
  // @see \Drupal\apigee_edge\Entity\Developer::getCompanies()
  return $entity
    ->getCompanies();
}