public function Merge::insertFields in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Database/Query/Merge.php \Drupal\Core\Database\Query\Merge::insertFields()
- 9 core/lib/Drupal/Core/Database/Query/Merge.php \Drupal\Core\Database\Query\Merge::insertFields()
Adds a set of field->value pairs to be inserted.
Parameters
$fields: An array of fields on which to insert. This array may be indexed or associative. If indexed, the array is taken to be the list of fields. If associative, the keys of the array are taken to be the fields and the values are taken to be corresponding values to insert. If a $values argument is provided, $fields must be indexed.
$values: An array of fields to insert into the database. The values must be specified in the same order as the $fields array.
Return value
$this The called object.
File
- core/
lib/ Drupal/ Core/ Database/ Query/ Merge.php, line 221
Class
- Merge
- General class for an abstracted MERGE query operation.
Namespace
Drupal\Core\Database\QueryCode
public function insertFields(array $fields, array $values = []) {
if ($values) {
$fields = array_combine($fields, $values);
}
$this->insertFields = $fields;
return $this;
}