function AliasRepository::pathHasMatchingAlias

Same name in other branches
  1. 9 core/modules/path_alias/src/AliasRepository.php \Drupal\path_alias\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/lib/Drupal/Core/Path/AliasRepository.php, line 104

Class

AliasRepository
Provides the default path alias lookup operations.

Namespace

Drupal\Core\Path

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.