You are here

public function BlockContent::delete in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/block_content/src/Entity/BlockContent.php \Drupal\block_content\Entity\BlockContent::delete()
  2. 9 core/modules/block_content/src/Entity/BlockContent.php \Drupal\block_content\Entity\BlockContent::delete()

Deletes an entity permanently.

Throws

\Drupal\Core\Entity\EntityStorageException In case of failures an exception is thrown.

Overrides EntityBase::delete

File

core/modules/block_content/src/Entity/BlockContent.php, line 168

Class

BlockContent
Defines the custom block entity class.

Namespace

Drupal\block_content\Entity

Code

public function delete() {
  foreach ($this
    ->getInstances() as $instance) {
    $instance
      ->delete();
  }
  parent::delete();
}