diff --git a/core/modules/hal/src/Normalizer/ContentEntityNormalizer.php b/core/modules/hal/src/Normalizer/ContentEntityNormalizer.php index a6ba04049a..6a54b3c502 100644 --- a/core/modules/hal/src/Normalizer/ContentEntityNormalizer.php +++ b/core/modules/hal/src/Normalizer/ContentEntityNormalizer.php @@ -171,6 +171,10 @@ public function denormalize($data, $class, $format = NULL, array $context = arra $this->denormalizeFieldData($data, $entity, $format, $context); + // Pass the names of the fields whose values can be merged. + // @todo https://www.drupal.org/node/2456257 remove this. + $entity->_restSubmittedFields = array_keys($data); + return $entity; } diff --git a/core/modules/serialization/src/Normalizer/EntityNormalizer.php b/core/modules/serialization/src/Normalizer/EntityNormalizer.php index c332c4d79f..84baec94be 100644 --- a/core/modules/serialization/src/Normalizer/EntityNormalizer.php +++ b/core/modules/serialization/src/Normalizer/EntityNormalizer.php @@ -55,6 +55,10 @@ public function denormalize($data, $class, $format = NULL, array $context = []) $entity = $this->entityManager->getStorage($entity_type_id)->create($data); } + // Pass the names of the fields whose values can be merged. + // @todo https://www.drupal.org/node/2456257 remove this. + $entity->_restSubmittedFields = array_keys($data); + return $entity; } diff --git a/core/modules/serialization/src/Normalizer/FieldableEntityNormalizerTrait.php b/core/modules/serialization/src/Normalizer/FieldableEntityNormalizerTrait.php index aebf48ac7a..516885374f 100644 --- a/core/modules/serialization/src/Normalizer/FieldableEntityNormalizerTrait.php +++ b/core/modules/serialization/src/Normalizer/FieldableEntityNormalizerTrait.php @@ -119,10 +119,6 @@ protected function extractBundleData(array &$data, EntityTypeInterface $entity_t * The context data. */ protected function denormalizeFieldData(array $data, FieldableEntityInterface $entity, $format, array $context) { - // Pass the names of the fields whose values can be merged. - // @todo https://www.drupal.org/node/2456257 remove this. - $entity->_restSubmittedFields = array_keys($data); - foreach ($data as $field_name => $field_data) { $field_item_list = $entity->get($field_name);