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\EntityCode
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);
}