You are here

public function EntityLegalDocument::delete in Entity Legal 3.0.x

Same name and namespace in other branches
  1. 8.2 src/Entity/EntityLegalDocument.php \Drupal\entity_legal\Entity\EntityLegalDocument::delete()
  2. 4.0.x src/Entity/EntityLegalDocument.php \Drupal\entity_legal\Entity\EntityLegalDocument::delete()

Deletes an entity permanently.

Throws

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

Overrides EntityBase::delete

File

src/Entity/EntityLegalDocument.php, line 103

Class

EntityLegalDocument
Defines the entity legal document entity.

Namespace

Drupal\entity_legal\Entity

Code

public function delete() {
  if (!$this
    ->isNew()) {

    // Delete all associated versions.
    $versions = $this
      ->getAllVersions();
    foreach ($versions as $version) {
      $version
        ->delete();
    }
  }
  parent::delete();
}