You are here

public static function PathAlias::postDelete in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/path_alias/src/Entity/PathAlias.php \Drupal\path_alias\Entity\PathAlias::postDelete()

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

core/modules/path_alias/src/Entity/PathAlias.php, line 119

Class

PathAlias
Defines the path_alias entity class.

Namespace

Drupal\path_alias\Entity

Code

public static function postDelete(EntityStorageInterface $storage, array $entities) {
  parent::postDelete($storage, $entities);
  $alias_manager = \Drupal::service('path_alias.manager');
  foreach ($entities as $entity) {
    $alias_manager
      ->cacheClear($entity
      ->getPath());
  }
}