Loading core/modules/jsonapi/src/Normalizer/FieldItemNormalizer.php +7 −6 Original line number Diff line number Diff line Loading @@ -92,6 +92,13 @@ public function denormalize($data, $class, $format = NULL, array $context = []): $item_definition = $context['field_definition']->getItemDefinition(); assert($item_definition instanceof FieldItemDataDefinitionInterface); // The NULL normalization means there is no value, hence we can return // early. Note that this is not just an optimization but a necessity for // field types without main properties (such as the "map" field type). if ($data === NULL) { return $data; } $field_item = $this->getFieldItemInstance($context['resource_type'], $item_definition); $this->checkForSerializedStrings($data, $class, $field_item); Loading @@ -113,12 +120,6 @@ public function denormalize($data, $class, $format = NULL, array $context = []): // be expanded to an array of all properties, we special-case single-value // properties. if (!is_array($data)) { // The NULL normalization means there is no value, hence we can return // early. Note that this is not just an optimization but a necessity for // field types without main properties (such as the "map" field type). if ($data === NULL) { return $data; } $property_value = $data; $property_name = $item_definition->getMainPropertyName(); $property_value_class = $property_definitions[$property_name]->getClass(); Loading Loading
core/modules/jsonapi/src/Normalizer/FieldItemNormalizer.php +7 −6 Original line number Diff line number Diff line Loading @@ -92,6 +92,13 @@ public function denormalize($data, $class, $format = NULL, array $context = []): $item_definition = $context['field_definition']->getItemDefinition(); assert($item_definition instanceof FieldItemDataDefinitionInterface); // The NULL normalization means there is no value, hence we can return // early. Note that this is not just an optimization but a necessity for // field types without main properties (such as the "map" field type). if ($data === NULL) { return $data; } $field_item = $this->getFieldItemInstance($context['resource_type'], $item_definition); $this->checkForSerializedStrings($data, $class, $field_item); Loading @@ -113,12 +120,6 @@ public function denormalize($data, $class, $format = NULL, array $context = []): // be expanded to an array of all properties, we special-case single-value // properties. if (!is_array($data)) { // The NULL normalization means there is no value, hence we can return // early. Note that this is not just an optimization but a necessity for // field types without main properties (such as the "map" field type). if ($data === NULL) { return $data; } $property_value = $data; $property_name = $item_definition->getMainPropertyName(); $property_value_class = $property_definitions[$property_name]->getClass(); Loading