You are here

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

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

Deletes an entity permanently.

Throws

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

Overrides EntityBase::delete

File

src/Entity/EntityLegalDocumentVersion.php, line 120

Class

EntityLegalDocumentVersion
Defines the entity legal document version entity.

Namespace

Drupal\entity_legal\Entity

Code

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

    // Delete all acceptances.
    $acceptances = $this
      ->getAcceptances();
    foreach ($acceptances as $acceptance) {
      $acceptance
        ->delete();
    }
  }
  parent::delete();
}