public function MongodbPathAliasStorage::load in MongoDB 8
Fetches a specific URL alias from the database.
The default implementation performs case-insensitive matching on the 'source' and 'alias' strings.
Parameters
array $conditions: An array of query conditions.
Return value
array|false FALSE if no alias was found or an associative array containing the following keys:
- source (string): The internal system path with a starting slash.
- alias (string): The URL alias with a starting slash.
- pid (int): Unique path alias identifier.
- langcode (string): The language code of the alias.
Overrides AliasStorageInterface::load
1 call to MongodbPathAliasStorage::load()
- MongodbPathAliasStorage::delete in src/
MongodbPathAliasStorage.php - Deletes a URL alias.
File
- src/
MongodbPathAliasStorage.php, line 89 - Contains Drupal\mongodb\Path.
Class
- MongodbPathAliasStorage
- Provides a class for CRUD operations on path aliases in MongoDB.
Namespace
Drupal\mongodbCode
public function load($conditions) {
if (isset($conditions['pid'])) {
$conditions['_id'] = intval($conditions['pid']);
unset($conditions['pid']);
}
$result = $this
->mongoCollection()
->findOne($conditions);
// $result will be NULL on failure, but PathInterface::load requires FALSE.
if (empty($result)) {
$result = FALSE;
}
else {
// Code in core assumes the id is called "pid", not "_id".
$result['pid'] = $result['_id'];
}
return $result;
}