You are here

protected function StringMongoDBStorage::checkVersion in MongoDB 8

Checks whether the string version matches a given version, fix it if not.

Parameters

\Drupal\locale\StringInterface $string: The string object.

string $version: Drupal version to check against.

1 call to StringMongoDBStorage::checkVersion()
StringMongoDBStorage::findTranslation in mongodb_locale/src/StringStorage.php
Loads a string translation object, fast query.

File

mongodb_locale/src/StringStorage.php, line 212

Class

StringMongoDBStorage

Namespace

Drupal\mongodb_locale

Code

protected function checkVersion($string, $version) {
  if ($string
    ->getId() && $string
    ->getVersion() != $version) {
    $string
      ->setVersion($version);
    $update['$set']['version'] = $version;
    $this->mongo
      ->get('locale')
      ->update($this
      ->getIdCriteria($string
      ->getId()), $update);
  }
}