function AliasRepository::pathHasMatchingAlias

Same name in other branches
  1. 9 core/modules/path_alias/src/AliasRepository.php \Drupal\path_alias\AliasRepository::pathHasMatchingAlias()
  2. 8.9.x core/lib/Drupal/Core/Path/AliasRepository.php \Drupal\Core\Path\AliasRepository::pathHasMatchingAlias()
  3. 10 core/modules/path_alias/src/AliasRepository.php \Drupal\path_alias\AliasRepository::pathHasMatchingAlias()

File

core/modules/path_alias/src/AliasRepository.php, line 100

Class

AliasRepository
Provides the default path alias lookup operations.

Namespace

Drupal\path_alias

Code

public function pathHasMatchingAlias($initial_substring) {
    $query = $this->getBaseQuery();
    $query->addExpression(1);
    return (bool) $query->condition('base_table.path', $this->connection
        ->escapeLike($initial_substring) . '%', 'LIKE')
        ->range(0, 1)
        ->execute()
        ->fetchField();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.