You are here

public function EntityUsage::bulkDeleteHosts in Entity Usage 8

Remove all records of a given entity_type (host).

Parameters

string $re_type: The type of the referencing entity (host).

Overrides EntityUsageInterface::bulkDeleteHosts

File

src/EntityUsage.php, line 133

Class

EntityUsage
Defines the entity usage base class.

Namespace

Drupal\entity_usage

Code

public function bulkDeleteHosts($re_type) {

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