You are here

public function EntityUsage::bulkDeleteTargets in Entity Usage 8

Same name and namespace in other branches
  1. 8.4 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 entity_type (target).

Parameters

string $t_type: The type of the target entity (referenced).

Overrides EntityUsageInterface::bulkDeleteTargets

File

src/EntityUsage.php, line 118

Class

EntityUsage
Defines the entity usage base class.

Namespace

Drupal\entity_usage

Code

public function bulkDeleteTargets($t_type) {

  // Delete all rows of this given type.
  $query = $this->connection
    ->delete($this->tableName)
    ->condition('t_type', $t_type);
  $query
    ->execute();
  $event = new EntityUsageEvent(NULL, $t_type, NULL, NULL, NULL, NULL);
  $this->eventDispatcher
    ->dispatch(Events::BULK_TARGETS_DELETE, $event);
}