You are here

public function DeveloperAppEdgeEntityControllerProxy::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

src/Entity/Controller/DeveloperAppEdgeEntityControllerProxy.php, line 95

Class

DeveloperAppEdgeEntityControllerProxy
Developer app specific entity controller implementation.

Namespace

Drupal\apigee_edge\Entity\Controller

Code

public function delete(string $id) : void {

  // Try to be smart here and load the app from the developer app
  // entity cache (app controller's cache is probably empty unless there were
  // a load() or getEntities() call before).
  $entity = \Drupal::entityTypeManager()
    ->getStorage('developer_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\DeveloperAppInterface $entity */
  $controller = $this->devAppControllerFactory
    ->developerAppController($entity
    ->getDeveloperId());

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