You are here

public function AliasStorageHelper::countBySourcePrefix in Pathauto 8

Returns the count of url aliases for the source.

Parameters

$source: An internal Drupal path prefix.

Return value

int Number of url aliases for the source.

Overrides AliasStorageHelperInterface::countBySourcePrefix

File

src/AliasStorageHelper.php, line 221

Class

AliasStorageHelper
Provides helper methods for accessing alias storage.

Namespace

Drupal\pathauto

Code

public function countBySourcePrefix($source) {
  return $this->entityTypeManager
    ->getStorage('path_alias')
    ->getQuery('OR')
    ->condition('path', $source, '=')
    ->condition('path', rtrim($source, '/') . '/', 'STARTS_WITH')
    ->count()
    ->execute();
}