You are here

protected function DbHelper::singleEntityUpdate in MongoDB 8

1 call to DbHelper::singleEntityUpdate()
DbHelper::do4b9334be in drivers/lib/Drupal/Driver/Database/mongodb/DbHelper.php
db_update() in NodeRevisionsTest::testRevisions()

File

drivers/lib/Drupal/Driver/Database/mongodb/DbHelper.php, line 108
Contains \Drupal\Driver\Database\mongodb\TestQuery.

Class

DbHelper

Namespace

Drupal\Driver\Database\mongodb

Code

protected function singleEntityUpdate($entity_type_id, $is_revision = FALSE) {
  $entity_id = $this->calls['condition'][0][1];
  list($field, $value) = each($this->calls['fields'][0][0]);
  $prefix = $is_revision ? 'entity_revision' : 'entity';
  $this->mongo
    ->get("{$prefix}.{$entity_type_id}")
    ->update([
    '_id' => $entity_id,
  ], [
    '$set' => [
      "values.0.{$field}.0.value" => $value,
    ],
  ]);
}