AliasStorage::pathHasMatchingAlias

public AliasStorage::pathHasMatchingAlias($initial_substring)

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 352

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(static::TABLE, 'u');
  $query->addExpression(1);
  try {
    return (bool) $query
    ->condition('u.source', $this->connection->escapeLike($initial_substring) . '%', 'LIKE')
      ->range(0, 1)
      ->execute()
      ->fetchField();
  }
  catch (\Exception $e) {
    $this->catchException($e);
    return FALSE;
  }
}
doc_Drupal
2016-10-29 08:44:15
Comments
Leave a Comment

Please login to continue.