You are here

public function AliasStorage::pathHasMatchingAlias in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Path/AliasStorage.php \Drupal\Core\Path\AliasStorage::pathHasMatchingAlias()

Check if any alias exists starting with $initial_substring.

Parameters

string $initial_substring: Initial path substring to test against.

Return value

bool TRUE if any alias exists, FALSE otherwise.

Overrides AliasStorageInterface::pathHasMatchingAlias

File

core/lib/Drupal/Core/Path/AliasStorage.php, line 278
Contains \Drupal\Core\Path\AliasStorage.

Class

AliasStorage
Provides a class for CRUD operations on path aliases.

Namespace

Drupal\Core\Path

Code

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