core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php b/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php index ad521ec..fba244a 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php @@ -86,6 +86,7 @@ protected function doCreate(array $values) { } $entity = new $this->entityClass([], $this->entityTypeId, $bundle); $this->initFieldValues($entity, $values); + $entity->resetChangedFieldList(); return $entity; } @@ -102,17 +103,14 @@ protected function doCreate(array $values) { * is provided all fields will be initialized. */ protected function initFieldValues(ContentEntityInterface $entity, array $values = [], array $field_names = []) { - // Do not notify when setting values, because these are initial values. - $notify = FALSE; - // Populate field values. foreach ($entity as $name => $field) { if (!$field_names || isset($field_names[$name])) { if (isset($values[$name])) { - $entity->$name->setValue($values[$name], $notify); + $entity->$name = $values[$name]; } elseif (!array_key_exists($name, $values)) { - $entity->get($name)->applyDefaultValue($notify); + $entity->get($name)->applyDefaultValue(); } } unset($values[$name]); @@ -138,6 +136,7 @@ public function createTranslation(ContentEntityInterface $entity, $langcode, arr $values[$this->getEntityType()->getKey('default_langcode')] = FALSE; $this->initFieldValues($translation, $values, $field_names); $this->invokeHook('translation_create', $translation); + $translation->resetChangedFieldList(); return $translation; }