function Upsert::key

Same name and namespace in other branches
  1. 10 core/lib/Drupal/Core/Database/Query/Upsert.php \Drupal\Core\Database\Query\Upsert::key()
  2. 9 core/lib/Drupal/Core/Database/Query/Upsert.php \Drupal\Core\Database\Query\Upsert::key()
  3. 8.9.x core/lib/Drupal/Core/Database/Query/Upsert.php \Drupal\Core\Database\Query\Upsert::key()
  4. main core/lib/Drupal/Core/Database/Query/Upsert.php \Drupal\Core\Database\Query\Upsert::key()

Sets the unique / primary key field(s) to be used as condition.

Parameters

string|string[] $field: The name of the field, or an array of field names for a composite key.

Return value

$this

File

core/lib/Drupal/Core/Database/Query/Upsert.php, line 48

Class

Upsert
General class for an abstracted "Upsert" (UPDATE or INSERT) query operation.

Namespace

Drupal\Core\Database\Query

Code

public function key(string|array $field) {
  $this->key = (array) $field;
  return $this;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.