public function Merge::insertFields

public Merge::insertFields(array $fields, array $values = array())

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 217

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;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Database!Query!Merge.php/function/Merge::insertFields/8.1.x