You are here

public function WebformAccessGroupStorage::delete in Webform 8.5

Same name and namespace in other branches
  1. 6.x modules/webform_access/src/WebformAccessGroupStorage.php \Drupal\webform_access\WebformAccessGroupStorage::delete()

Deletes permanently saved entities.

Parameters

array $entities: An array of entity objects to delete.

Throws

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

Overrides EntityStorageBase::delete

File

modules/webform_access/src/WebformAccessGroupStorage.php, line 192

Class

WebformAccessGroupStorage
Storage controller class for "webform_access_group" configuration entities.

Namespace

Drupal\webform_access

Code

public function delete(array $entities) {

  /** @var \Drupal\webform_access\WebformAccessGroupInterface[] $entities */
  foreach ($entities as $entity) {
    $this->database
      ->delete('webform_access_group_admin')
      ->condition('group_id', $entity
      ->id())
      ->execute();
    $this->database
      ->delete('webform_access_group_user')
      ->condition('group_id', $entity
      ->id())
      ->execute();
    $this->database
      ->delete('webform_access_group_entity')
      ->condition('group_id', $entity
      ->id())
      ->execute();
  }
  return parent::delete($entities);
}