You are here

public function EntityUsage::bulkDeleteTargets in Entity Usage 8.4

Same name and namespace in other branches
  1. 8 src/EntityUsage.php \Drupal\entity_usage\EntityUsage::bulkDeleteTargets()
  2. 8.2 src/EntityUsage.php \Drupal\entity_usage\EntityUsage::bulkDeleteTargets()
  3. 8.3 src/EntityUsage.php \Drupal\entity_usage\EntityUsage::bulkDeleteTargets()

Remove all records of a given target entity type.

Parameters

string $target_type: The target entity type.

Overrides EntityUsageInterface::bulkDeleteTargets

File

src/EntityUsage.php, line 148

Class

EntityUsage
Defines the entity usage base class.

Namespace

Drupal\entity_usage

Code

public function bulkDeleteTargets($target_type) {
  $query = $this->connection
    ->delete($this->tableName)
    ->condition('target_type', $target_type);
  $query
    ->execute();
  $event = new EntityUsageEvent(NULL, $target_type, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
  $this->eventDispatcher
    ->dispatch(Events::BULK_DELETE_DESTINATIONS, $event);
}