function AliasRepository::lookupBySystemPath

Same name in other branches
  1. 9 core/modules/path_alias/src/AliasRepository.php \Drupal\path_alias\AliasRepository::lookupBySystemPath()
  2. 10 core/modules/path_alias/src/AliasRepository.php \Drupal\path_alias\AliasRepository::lookupBySystemPath()
  3. 11.x core/modules/path_alias/src/AliasRepository.php \Drupal\path_alias\AliasRepository::lookupBySystemPath()

Overrides AliasRepositoryInterface::lookupBySystemPath

File

core/lib/Drupal/Core/Path/AliasRepository.php, line 72

Class

AliasRepository
Provides the default path alias lookup operations.

Namespace

Drupal\Core\Path

Code

public function lookupBySystemPath($path, $langcode) {
    // See the queries above. Use LIKE for case-insensitive matching.
    $select = $this->getBaseQuery()
        ->fields('base_table', [
        'id',
        'path',
        'alias',
        'langcode',
    ])
        ->condition('base_table.path', $this->connection
        ->escapeLike($path), 'LIKE');
    $this->addLanguageFallback($select, $langcode);
    $select->orderBy('base_table.id', 'DESC');
    return $select->execute()
        ->fetchAssoc() ?: NULL;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.