function apigee_edge_user_delete in Apigee Edge 8
Implements hook_user_delete().
File
- ./apigee_edge.module, line 1463 
- Copyright 2018 Google Inc.
Code
function apigee_edge_user_delete(UserInterface $account) {
  // Do not try to delete developer of the anonymous user because it does
  // not exist.
  if ($account
    ->isAnonymous()) {
    return;
  }
  try {
    /** @var \Drupal\apigee_edge\Entity\Developer $developer */
    $developer = Developer::load($account
      ->getEmail());
    // Sanity check, the developer may not exist in Apigee Edge.
    if ($developer) {
      $developer
        ->delete();
    }
  } catch (\Exception $exception) {
    $context = [
      '@developer' => $account
        ->getEmail(),
      '@message' => (string) $exception,
    ];
    watchdog_exception('apigee_edge', $exception, 'Could not delete @developer developer entity. @message %function (line %line of %file). <pre>@backtrace_string</pre>', $context);
  }
}