You are here

public function Merge::insertFields in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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

\Drupal\Core\Database\Query\Merge The called object.

File

core/lib/Drupal/Core/Database/Query/Merge.php, line 222
Contains \Drupal\Core\Database\Query\Merge.

Class

Merge
General class for an abstracted MERGE query operation.

Namespace

Drupal\Core\Database\Query

Code

public function insertFields(array $fields, array $values = array()) {
  if ($values) {
    $fields = array_combine($fields, $values);
  }
  $this->insertFields = $fields;
  return $this;
}