public static function AccessScheme::postDelete in Workbench Access 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/ AccessScheme.php, line 156
Class
- AccessScheme
- Defines the Access scheme entity.
Namespace
Drupal\workbench_access\EntityCode
public static function postDelete(EntityStorageInterface $storage, array $entities) {
parent::postDelete($storage, $entities);
// Delete all associated storage.
$section_storage = \Drupal::entityTypeManager()
->getStorage('section_association');
foreach ($entities as $entity) {
$sections = $section_storage
->loadByProperties([
'access_scheme' => $entity
->id(),
]);
$section_storage
->delete($sections);
\Drupal::service('workbench_access.user_section_storage')
->resetCache($entity);
}
}