You are here

public static function TemplateCollection::preDelete in Courier 8

Same name and namespace in other branches
  1. 2.x src/Entity/TemplateCollection.php \Drupal\courier\Entity\TemplateCollection::preDelete()

Acts on entities before they are deleted and before hooks are invoked.

Used before the entities are deleted and 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::preDelete

File

src/Entity/TemplateCollection.php, line 174

Class

TemplateCollection
Defines a local template collection entity.

Namespace

Drupal\courier\Entity

Code

public static function preDelete(EntityStorageInterface $storage, array $entities) {

  /** @var static[] $entities */
  foreach ($entities as $template_collection) {
    foreach ($template_collection
      ->getTemplates() as $template) {
      $template
        ->delete();
    }
  }
  parent::preDelete($storage, $entities);
}