You are here

public function MongodbMenuTreeStorage::loadMultiple in MongoDB 8

Loads multiple plugin definitions from the storage.

Parameters

array $ids: An array of plugin IDs.

Return value

array An array of plugin definition arrays keyed by plugin ID, which are the actual definitions after the loadMultiple() including all those plugins from $ids.

Overrides MenuTreeStorage::loadMultiple

File

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

Class

MongodbMenuTreeStorage

Namespace

Drupal\mongodb

Code

public function loadMultiple(array $ids) {
  $missing_ids = array_diff($ids, array_keys($this->definitions));
  if ($missing_ids) {
    $query['value.id']['$in'] = array_values($missing_ids);
    foreach ($this
      ->mongoCollection()
      ->find($query) as $link) {
      $link = $link['value'];
      $this->definitions[$link['id']] = $this
        ->prepareLink($link);
    }
  }
  return array_intersect_key($this->definitions, array_flip($ids));
}