You are here

protected function MongodbMenuTreeStorage::getIds in MongoDB 8

Parameters

array $query:

array|null $sort:

Return value

array

3 calls to MongodbMenuTreeStorage::getIds()
MongodbMenuTreeStorage::getAllChildIds in src/MongodbMenuTreeStorage.php
Loads all the IDs for menu links that are below the given ID.
MongodbMenuTreeStorage::getExpanded in src/MongodbMenuTreeStorage.php
Finds expanded links in a menu given a set of possible parents.
MongodbMenuTreeStorage::getRootPathIds in src/MongodbMenuTreeStorage.php
Returns all the IDs that represent the path to the root of the tree.

File

src/MongodbMenuTreeStorage.php, line 431
Contains \Drupal\mongodb\MongodbMenuTreeStorage .

Class

MongodbMenuTreeStorage

Namespace

Drupal\mongodb

Code

protected function getIds(array $query, array $sort = NULL) {
  $cursor = $this
    ->mongoCollection()
    ->find($query, [
    'value.id' => 1,
  ]);
  if (isset($sort)) {
    $cursor
      ->sort($sort);
  }
  $ids = [];
  foreach ($cursor as $link) {
    $ids[$link['value']['id']] = $link['value']['id'];
  }
  return $ids;
}