public function AliasRepository::pathHasMatchingAlias in Drupal 9
Check if any alias exists starting with $initial_substring.
Parameters
string $initial_substring: Initial system path substring to test against.
Return value
bool TRUE if any alias exists, FALSE otherwise.
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_aliasCode
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();
}