8.5.x Entity.php Entity::delete()
8.0.x Entity.php Entity::delete()
8.1.x Entity.php Entity::delete()
8.2.x Entity.php Entity::delete()
8.3.x Entity.php Entity::delete()
8.4.x Entity.php Entity::delete()
8.6.x Entity.php Entity::delete()

Deletes an entity permanently.

Throws

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

Overrides EntityInterface::delete

1 call to Entity::delete()
BlockContent::delete in core/modules/block_content/src/Entity/BlockContent.php
Deletes an entity permanently.
1 method overrides Entity::delete()
BlockContent::delete in core/modules/block_content/src/Entity/BlockContent.php
Deletes an entity permanently.

File

core/lib/Drupal/Core/Entity/Entity.php, line 370

Class

Entity
Defines a base entity class.

Namespace

Drupal\Core\Entity

Code

public function delete() {
  if (!$this
    ->isNew()) {
    $this
      ->entityManager()
      ->getStorage($this->entityTypeId)
      ->delete(array(
      $this
        ->id() => $this,
    ));
  }
}