Skip to content
Snippets Groups Projects
Unverified Commit 819a788e authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3027574 by tuutti: SqlContentEntityStorage no longer update entities...

Issue #3027574 by tuutti: SqlContentEntityStorage no longer update entities with certain (id) fields
parent 55ce9ce3
Branches
Tags
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -824,13 +824,14 @@ protected function doSaveFieldItems(ContentEntityInterface $entity, array $names ...@@ -824,13 +824,14 @@ protected function doSaveFieldItems(ContentEntityInterface $entity, array $names
if ($update) { if ($update) {
$default_revision = $entity->isDefaultRevision(); $default_revision = $entity->isDefaultRevision();
if ($default_revision) { if ($default_revision) {
$id = $record->{$this->idKey};
// Remove the ID from the record to enable updates on SQL variants // Remove the ID from the record to enable updates on SQL variants
// that prevent updating serial columns, for example, mssql. // that prevent updating serial columns, for example, mssql.
unset($record->{$this->idKey}); unset($record->{$this->idKey});
$this->database $this->database
->update($this->baseTable) ->update($this->baseTable)
->fields((array) $record) ->fields((array) $record)
->condition($this->idKey, $entity->get($this->idKey)->value) ->condition($this->idKey, $id)
->execute(); ->execute();
} }
if ($this->revisionTable) { if ($this->revisionTable) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment