function AliasRepository::pathHasMatchingAlias

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

Overrides AliasRepositoryInterface::pathHasMatchingAlias

File

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

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.