You are here

function apigee_edge_teams_cron in Apigee Edge 8

Implements hook_cron().

File

modules/apigee_edge_teams/apigee_edge_teams.module, line 332
Copyright 2018 Google Inc.

Code

function apigee_edge_teams_cron() {

  /** @var \Drupal\apigee_edge_teams\Entity\Storage\TeamInvitationStorageInterface $storage */
  $storage = Drupal::entityTypeManager()
    ->getStorage('team_invitation');
  $team_invitations = $storage
    ->getInvitationsToExpire();
  if (!count($team_invitations)) {
    return;
  }

  // Update status for expired invitations.
  foreach ($team_invitations as $team_invitation) {
    $team_invitation
      ->setStatus(TeamInvitationInterface::STATUS_EXPIRED)
      ->save();
  }
}