function Merge::useDefaults

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Database/Query/Merge.php \Drupal\Core\Database\Query\Merge::useDefaults()
  2. 10 core/lib/Drupal/Core/Database/Query/Merge.php \Drupal\Core\Database\Query\Merge::useDefaults()
  3. 11.x core/lib/Drupal/Core/Database/Query/Merge.php \Drupal\Core\Database\Query\Merge::useDefaults()

Specifies fields for which the database-defaults should be used.

If you want to force a given field to use the database-defined default, not NULL or undefined, use this method to instruct the database to use default values explicitly. In most cases this will not be necessary unless you are inserting a row that is all default values, as you cannot specify no values in an INSERT query.

Specifying a field both in fields() and in useDefaults() is an error and will not execute.

Parameters

$fields: An array of values for which to use the default values specified in the table definition.

Return value

$this The called object.

File

core/lib/Drupal/Core/Database/Query/Merge.php, line 248

Class

Merge
General class for an abstracted MERGE query operation.

Namespace

Drupal\Core\Database\Query

Code

public function useDefaults(array $fields) {
    $this->defaultFields = $fields;
    return $this;
}

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