protected function MongodbMenuTreeStorage::doFindChildrenRelativeDepth in MongoDB 8
Finds the relative depth of this link's deepest child.
Parameters
array $original: The parent definition used to find the depth.
Return value
int Returns the relative depth.
Overrides MenuTreeStorage::doFindChildrenRelativeDepth
File
- src/
MongodbMenuTreeStorage.php, line 303 - Contains \Drupal\mongodb\MongodbMenuTreeStorage .
Class
Namespace
Drupal\mongodbCode
protected function doFindChildrenRelativeDepth(array $original) {
$max_depth = 0;
foreach ($this
->mongoCollection()
->find($this
->getChildrenQuery($original), [
'value.depth',
])
->sort([
'value.depth' => -1,
])
->limit(1) as $link) {
if ($link['value']['depth'] > $original['depth']) {
$max_depth = $link['value']['depth'] - $original['depth'];
}
}
return $max_depth;
}