You are here

protected function WebformSubmissionDevelGenerateTrait::deleteWebformSubmissions in Webform 8.5

Same name and namespace in other branches
  1. 6.x 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 325

Class

WebformSubmissionDevelGenerateTrait
Provides a WebformSubmissionDevelGenerate trait.

Namespace

Drupal\webform\Plugin\DevelGenerate

Code

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