You are here

public function AliasStorageHelper::deleteAll in Pathauto 8

Delete all aliases (truncate the path alias entity tables).

Overrides AliasStorageHelperInterface::deleteAll

File

src/AliasStorageHelper.php, line 189

Class

AliasStorageHelper
Provides helper methods for accessing alias storage.

Namespace

Drupal\pathauto

Code

public function deleteAll() {

  /** @var \Drupal\Core\Entity\Sql\TableMappingInterface $table_mapping */
  $table_mapping = $this->entityTypeManager
    ->getStorage('path_alias')
    ->getTableMapping();
  foreach ($table_mapping
    ->getTableNames() as $table_name) {
    $this->database
      ->truncate($table_name)
      ->execute();
  }
  $this->entityTypeManager
    ->getStorage('path_alias')
    ->resetCache();
}