You are here

protected function WebformSubmissionDevelGenerateTrait::deleteWebformSubmissions in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Plugin/DevelGenerate/WebformSubmissionDevelGenerateTrait.php \Drupal\webform\Plugin\DevelGenerate\WebformSubmissionDevelGenerateTrait::deleteWebformSubmissions()

Deletes all submissions of given webforms.

Parameters

array $webform_ids: Array of webform ids.

string|null $entity_type: A webform source entity type.

int|null $entity_id: A webform source entity id.

1 call to WebformSubmissionDevelGenerateTrait::deleteWebformSubmissions()
WebformSubmissionDevelGenerateTrait::generateSubmissions in src/Plugin/DevelGenerate/WebformSubmissionDevelGenerateTrait.php
Generates submissions for a list of given webforms.

File

src/Plugin/DevelGenerate/WebformSubmissionDevelGenerateTrait.php, line 266

Class

WebformSubmissionDevelGenerateTrait
Provides a WebformSubmissionDevelGenerate plugin.

Namespace

Drupal\webform\Plugin\DevelGenerate

Code

protected function deleteWebformSubmissions(array $webform_ids, $entity_type = NULL, $entity_id = NULL) {
  $webforms = $this
    ->getWebformStorage()
    ->loadMultiple($webform_ids);
  $entity = $entity_type && $entity_id ? $this
    ->getEntityStorage($entity_type)
    ->load($entity_id) : NULL;
  foreach ($webforms as $webform) {
    $this
      ->getSubmissionStorage()
      ->deleteAll($webform, $entity);
  }
}