getFieldItemInstance example

unset($context[CacheableNormalizerInterface::SERIALIZATION_CONTEXT_CACHEABILITY]);
    return $normalization;
  }

  /** * {@inheritdoc} */
  public function denormalize($data$class$format = NULL, array $context = []): mixed {
    $item_definition = $context['field_definition']->getItemDefinition();
    assert($item_definition instanceof FieldItemDataDefinitionInterface);

    $field_item = $this->getFieldItemInstance($context['resource_type']$item_definition);
    $this->checkForSerializedStrings($data$class$field_item);

    $property_definitions = $item_definition->getPropertyDefinitions();

    $serialized_property_names = $this->getCustomSerializedPropertyNames($field_item);
    $denormalize_property = function D$property_name$property_value$property_value_class$format$context) use ($serialized_property_names) {
      if ($this->serializer->supportsDenormalization($property_value$property_value_class$format$context)) {
        return $this->serializer->denormalize($property_value$property_value_class$format$context);
      }
      else {
        if (in_array($property_name$serialized_property_names, TRUE)) {
          
Home | Imprint | This part of the site doesn't use cookies.