By amateescu on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
11.4.x
Introduced in version:
11.4.0
Issue links:
Description:
Upsert database queries can now be used on tables with unique/primary keys composed of multiple fields.
For this purpose, a new \Drupal\Core\Database\Query\Upsert::keyColumns() method was added, and \Drupal\Core\Database\Query\Upsert::key() has been deprecated.
Usage example for a table with a composite primary key on the collection and name columns:
$this->connection->upsert($this->table)
->key(['collection', 'name'])
->fields([
'collection' => $collection,
'name' => $key,
'value' => $value,
])
->execute();
Impacts:
Module developers