You are here

protected function MongodbMenuTreeStorage::findNoLongerExistingLinks in MongoDB 8

Find any previously discovered menu links that no longer exist.

Parameters

array $definitions: The new menu link definitions.

Return value

array A list of menu link IDs that no longer exist.

Overrides MenuTreeStorage::findNoLongerExistingLinks

File

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

Class

MongodbMenuTreeStorage

Namespace

Drupal\mongodb

Code

protected function findNoLongerExistingLinks(array $definitions) {
  $result = [];
  if ($definitions) {
    $find['value.id']['$nin'] = array_keys($definitions);
    $find['value.discovered'] = 1;
    foreach ($this
      ->mongoCollection()
      ->find($find, [
      'value.id',
    ])
      ->sort([
      'value.depth' => -1,
    ]) as $link) {
      $id = $link['value']['id'];
      $result[$id] = $id;
    }
  }
  return $result;
}