You are here

public function TeamMemberRoleStorage::loadByDeveloperAndTeam in Apigee Edge 8

Loads team member role object by developer and team.

WARNING: The fact whether the developer is actually member of the team (company) in Apigee Edge is not being verified here. The caller should perform this check if needed. Thanks for this approach we can minimize the API calls that are being sent to Apigee Edge.

Parameters

\Drupal\Core\Session\AccountInterface $account: User entity object of a developer.

\Drupal\apigee_edge_teams\Entity\TeamInterface $team: Team entity object.

Return value

\Drupal\apigee_edge_teams\Entity\TeamMemberRoleInterface|null Team member role object if the developer has team roles within a team, null otherwise.

Overrides TeamMemberRoleStorageInterface::loadByDeveloperAndTeam

2 calls to TeamMemberRoleStorage::loadByDeveloperAndTeam()
TeamMemberRoleStorage::addTeamRoles in modules/apigee_edge_teams/src/Entity/Storage/TeamMemberRoleStorage.php
Adds team roles to a developer in a team.
TeamMemberRoleStorage::removeTeamRoles in modules/apigee_edge_teams/src/Entity/Storage/TeamMemberRoleStorage.php
Removes team roles of a developer within a team.

File

modules/apigee_edge_teams/src/Entity/Storage/TeamMemberRoleStorage.php, line 114

Class

TeamMemberRoleStorage
Entity storage class for team member role entities.

Namespace

Drupal\apigee_edge_teams\Entity\Storage

Code

public function loadByDeveloperAndTeam(AccountInterface $account, TeamInterface $team) : ?TeamMemberRoleInterface {
  $result = $this
    ->loadByProperties([
    'uid' => $account
      ->id(),
    'team' => $team
      ->id(),
  ]);
  $result = reset($result);
  return $result ? $result : NULL;
}