You are here

public function EntityUsage::bulkDeleteSources in Entity Usage 8.2

Same name and namespace in other branches
  1. 8.4 src/EntityUsage.php \Drupal\entity_usage\EntityUsage::bulkDeleteSources()
  2. 8.3 src/EntityUsage.php \Drupal\entity_usage\EntityUsage::bulkDeleteSources()

Remove all records of a given source entity type.

Parameters

string $source_type: The source entity type.

Overrides EntityUsageInterface::bulkDeleteSources

File

src/EntityUsage.php, line 159

Class

EntityUsage
Defines the entity usage base class.

Namespace

Drupal\entity_usage

Code

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