You are here

public function WebformRevision::deleteRelatedContentEntities in Config Entity Revisions 8.2

Delete submissions related to a revision.

File

modules/webform_revisions/src/Entity/WebformRevision.php, line 53

Class

WebformRevision
Class WebformRevision.

Namespace

Drupal\webform_revisions\Entity

Code

public function deleteRelatedContentEntities($rid) {
  $sids = \Drupal::database()
    ->query("SELECT sid FROM {webform_submission} WHERE webform_revision = :rid", [
    ':rid' => $rid,
  ])
    ->fetchCol();
  $storage = \Drupal::entityTypeManager()
    ->getStorage('webform_submission');
  $submissions = $storage
    ->loadMultiple($sids);
  $storage
    ->delete($submissions);
}