You are here

public function TeamAppEdgeEntityControllerProxy::delete in Apigee Edge 8

Removes an entity from Apigee Edge.

Parameters

string $id: One of an entity's unique ids. (Some entities has more than one unique id at a moment, ex.: developer's email address and id (UUID).)

Overrides EdgeEntityControllerInterface::delete

File

modules/apigee_edge_teams/src/Entity/Controller/TeamAppEdgeEntityControllerProxy.php, line 97

Class

TeamAppEdgeEntityControllerProxy
Team app specific entity controller implementation.

Namespace

Drupal\apigee_edge_teams\Entity\Controller

Code

public function delete(string $id) : void {

  // Try to be smart here and load the app from the company app
  // entity cache (app controller's cache is probably empty unless there were
  // a load() or getEntities() call before).
  $entity = \Drupal::entityTypeManager()
    ->getStorage('team_app')
    ->load($id);
  if (!$entity) {

    // Entity has not found in the entity cache, we have it from Apigee Edge.
    $entity = $this
      ->load($id);
  }

  /** @var \Apigee\Edge\Api\Management\Entity\CompanyAppInterface $entity */
  $controller = $this->teamAppControllerFactory
    ->teamAppController($entity
    ->getCompanyName());

  // The id that we got is a UUID, what we need is an app name.
  $controller
    ->delete($entity
    ->getName());
}