You are here

public static function Developer::postDelete in Apigee Edge 8

Acts on deleted entities before the delete hook is invoked.

Used after the entities are deleted but before invoking the delete hook.

Parameters

\Drupal\Core\Entity\EntityStorageInterface $storage: The entity storage object.

\Drupal\Core\Entity\EntityInterface[] $entities: An array of entities.

Overrides EntityBase::postDelete

File

src/Entity/Developer.php, line 504

Class

Developer
Defines the Developer entity class.

Namespace

Drupal\apigee_edge\Entity

Code

public static function postDelete(EntityStorageInterface $storage, array $entities) {
  parent::postDelete($storage, $entities);

  /** @var \Drupal\apigee_edge\Entity\DeveloperCompaniesCacheInterface $cache */
  $cache = \Drupal::service('apigee_edge.controller.cache.developer_companies');
  $developer_mail_id_map = array_map(function (Developer $entity) {
    return $entity
      ->getDeveloperId();
  }, $entities);

  // Remove developer->company membership info from the memory cache.
  $cache
    ->remove($developer_mail_id_map);

  // Ensure that even if $storage:delete() got called with developer email
  // addresses, all cache entries that refers to the same developer by
  // its developer id (UUID) also gets invalidated.
  $storage
    ->resetCache($developer_mail_id_map);
}