You are here

public static function ConfigTest::postDelete in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/config/tests/config_test/src/Entity/ConfigTest.php \Drupal\config_test\Entity\ConfigTest::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 Entity::postDelete

File

core/modules/config/tests/config_test/src/Entity/ConfigTest.php, line 111
Contains \Drupal\config_test\Entity\ConfigTest.

Class

ConfigTest
Defines the ConfigTest configuration entity.

Namespace

Drupal\config_test\Entity

Code

public static function postDelete(EntityStorageInterface $storage, array $entities) {
  parent::postDelete($storage, $entities);
  foreach ($entities as $entity) {
    if ($entity
      ->id() == 'deleter') {
      $deletee = $storage
        ->load('deletee');
      $deletee
        ->delete();
    }
  }
}