You are here

public function MongodbNodeStorage::clearRevisionsLanguage in MongoDB 8

Unsets the language for all nodes with the given language.

Parameters

\Drupal\Core\Language\LanguageInterface $language: The language object.

Overrides NodeStorageInterface::clearRevisionsLanguage

File

mongodb_node/src/MongodbNodeStorage.php, line 63
Contains \Drupal\node\MongodbNodeStorage.

Class

MongodbNodeStorage

Namespace

Drupal\mongodb_node

Code

public function clearRevisionsLanguage(LanguageInterface $language) {
  $newobj['$set'] = [
    'values.$.langcode.0.value' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
  ];
  $query = [
    'values.langcode.0.value' => $language
      ->getId(),
  ];
  $this->mongo
    ->get('entity_revision.node')
    ->update($query, $newobj, [
    'multi' => TRUE,
  ]);
}