Skip to content

Commit f86a890

Browse files
committed
Issue #3027574 by tuutti: SqlContentEntityStorage no longer update entities with certain (id) fields
(cherry picked from commit 819a788)
1 parent b8f4f50 commit f86a890

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -821,13 +821,14 @@ protected function doSaveFieldItems(ContentEntityInterface $entity, array $names
821821
if ($update) {
822822
$default_revision = $entity->isDefaultRevision();
823823
if ($default_revision) {
824+
$id = $record->{$this->idKey};
824825
// Remove the ID from the record to enable updates on SQL variants
825826
// that prevent updating serial columns, for example, mssql.
826827
unset($record->{$this->idKey});
827828
$this->database
828829
->update($this->baseTable)
829830
->fields((array) $record)
830-
->condition($this->idKey, $entity->get($this->idKey)->value)
831+
->condition($this->idKey, $id)
831832
->execute();
832833
}
833834
if ($this->revisionTable) {

0 commit comments

Comments
 (0)