getExtensionFields example


        if (isset($row[$root . '.createdAt'])) {
            $entity->createdAt = new \DateTimeImmutable($row[$root . '.createdAt']);
        }
        if (isset($row[$root . '.updatedAt'])) {
            $entity->updatedAt = new \DateTimeImmutable($row[$root . '.updatedAt']);
        }
        $entity->product = $this->manyToOne($row$root$definition->getField('product')$context);
        $entity->productStream = $this->manyToOne($row$root$definition->getField('productStream')$context);

        $this->translate($definition$entity$row$root$context$definition->getTranslatedFields());
        $this->hydrateFields($definition$entity$root$row$context$definition->getExtensionFields());

        return $entity;
    }
}

        if (isset($row[$root . '.createdAt'])) {
            $entity->createdAt = new \DateTimeImmutable($row[$root . '.createdAt']);
        }
        if (isset($row[$root . '.updatedAt'])) {
            $entity->updatedAt = new \DateTimeImmutable($row[$root . '.updatedAt']);
        }
        $entity->product = $this->manyToOne($row$root$definition->getField('product')$context);
        $entity->media = $this->manyToOne($row$root$definition->getField('media')$context);

        $this->translate($definition$entity$row$root$context$definition->getTranslatedFields());
        $this->hydrateFields($definition$entity$root$row$context$definition->getExtensionFields());
        $this->customFields($definition$row$root$entity$definition->getField('customFields')$context);

        return $entity;
    }
}

        if (isset($row[$root . '.updatedAt'])) {
            $entity->updatedAt = new \DateTimeImmutable($row[$root . '.updatedAt']);
        }
        $entity->productStream = $this->manyToOne($row$root$definition->getField('productStream')$context);
        $entity->storefrontSalesChannel = $this->manyToOne($row$root$definition->getField('storefrontSalesChannel')$context);
        $entity->salesChannel = $this->manyToOne($row$root$definition->getField('salesChannel')$context);
        $entity->salesChannelDomain = $this->manyToOne($row$root$definition->getField('salesChannelDomain')$context);
        $entity->currency = $this->manyToOne($row$root$definition->getField('currency')$context);

        $this->translate($definition$entity$row$root$context$definition->getTranslatedFields());
        $this->hydrateFields($definition$entity$root$row$context$definition->getExtensionFields());

        return $entity;
    }
}

        $entity->deliveryTime = $this->manyToOne($row$root$definition->getField('deliveryTime')$context);
        $entity->tax = $this->manyToOne($row$root$definition->getField('tax')$context);
        $entity->manufacturer = $this->manyToOne($row$root$definition->getField('manufacturer')$context);
        $entity->unit = $this->manyToOne($row$root$definition->getField('unit')$context);
        $entity->cover = $this->manyToOne($row$root$definition->getField('cover')$context);
        $entity->featureSet = $this->manyToOne($row$root$definition->getField('featureSet')$context);
        $entity->cmsPage = $this->manyToOne($row$root$definition->getField('cmsPage')$context);
        $entity->canonicalProduct = $this->manyToOne($row$root$definition->getField('canonicalProduct')$context);

        $this->translate($definition$entity$row$root$context$definition->getTranslatedFields());
        $this->hydrateFields($definition$entity$root$row$context$definition->getExtensionFields());
        $this->customFields($definition$row$root$entity$definition->getField('customFields')$context);
        $this->manyToMany($row$root$entity$definition->getField('options'));
        $this->manyToMany($row$root$entity$definition->getField('properties'));
        $this->manyToMany($row$root$entity$definition->getField('categories'));
        $this->manyToMany($row$root$entity$definition->getField('streams'));
        $this->manyToMany($row$root$entity$definition->getField('categoriesRo'));
        $this->manyToMany($row$root$entity$definition->getField('tags'));
        $this->manyToMany($row$root$entity$definition->getField('customFieldSets'));

        return $entity;
    }
}
if (\array_key_exists($root . '.features', $row)) {
            $entity->features = $definition->decode('features', self::value($row$root, 'features'));
        }
        if (isset($row[$root . '.createdAt'])) {
            $entity->createdAt = new \DateTimeImmutable($row[$root . '.createdAt']);
        }
        if (isset($row[$root . '.updatedAt'])) {
            $entity->updatedAt = new \DateTimeImmutable($row[$root . '.updatedAt']);
        }

        $this->translate($definition$entity$row$root$context$definition->getTranslatedFields());
        $this->hydrateFields($definition$entity$root$row$context$definition->getExtensionFields());

        return $entity;
    }
}
$entity->link = $row[$root . '.link'];
        }
        if (isset($row[$root . '.createdAt'])) {
            $entity->createdAt = new \DateTimeImmutable($row[$root . '.createdAt']);
        }
        if (isset($row[$root . '.updatedAt'])) {
            $entity->updatedAt = new \DateTimeImmutable($row[$root . '.updatedAt']);
        }
        $entity->media = $this->manyToOne($row$root$definition->getField('media')$context);

        $this->translate($definition$entity$row$root$context$definition->getTranslatedFields());
        $this->hydrateFields($definition$entity$root$row$context$definition->getExtensionFields());
        $this->customFields($definition$row$root$entity$definition->getField('customFields')$context);

        return $entity;
    }
}
if (isset($row[$root . '.createdAt'])) {
            $entity->createdAt = new \DateTimeImmutable($row[$root . '.createdAt']);
        }
        if (isset($row[$root . '.updatedAt'])) {
            $entity->updatedAt = new \DateTimeImmutable($row[$root . '.updatedAt']);
        }
        $entity->product = $this->manyToOne($row$root$definition->getField('product')$context);
        $entity->media = $this->manyToOne($row$root$definition->getField('media')$context);
        $entity->option = $this->manyToOne($row$root$definition->getField('option')$context);

        $this->translate($definition$entity$row$root$context$definition->getTranslatedFields());
        $this->hydrateFields($definition$entity$root$row$context$definition->getExtensionFields());
        $this->customFields($definition$row$root$entity$definition->getField('customFields')$context);

        return $entity;
    }
}
$entity->languageId = Uuid::fromBytesToHex($row[$root . '.languageId']);
        }
        if (isset($row[$root . '.keyword'])) {
            $entity->keyword = $row[$root . '.keyword'];
        }
        if (isset($row[$root . '.reversed'])) {
            $entity->reversed = $row[$root . '.reversed'];
        }
        $entity->language = $this->manyToOne($row$root$definition->getField('language')$context);

        $this->translate($definition$entity$row$root$context$definition->getTranslatedFields());
        $this->hydrateFields($definition$entity$root$row$context$definition->getExtensionFields());

        return $entity;
    }
}
if (isset($row[$root . '.visibleOnProductDetailPage'])) {
            $entity->visibleOnProductDetailPage = (bool) $row[$root . '.visibleOnProductDetailPage'];
        }
        if (isset($row[$root . '.createdAt'])) {
            $entity->createdAt = new \DateTimeImmutable($row[$root . '.createdAt']);
        }
        if (isset($row[$root . '.updatedAt'])) {
            $entity->updatedAt = new \DateTimeImmutable($row[$root . '.updatedAt']);
        }

        $this->translate($definition$entity$row$root$context$definition->getTranslatedFields());
        $this->hydrateFields($definition$entity$root$row$context$definition->getExtensionFields());
        $this->customFields($definition$row$root$entity$definition->getField('customFields')$context);

        return $entity;
    }
}
$entity->excludedTerms = $definition->decode('excludedTerms', self::value($row$root, 'excludedTerms'));
        }
        if (isset($row[$root . '.createdAt'])) {
            $entity->createdAt = new \DateTimeImmutable($row[$root . '.createdAt']);
        }
        if (isset($row[$root . '.updatedAt'])) {
            $entity->updatedAt = new \DateTimeImmutable($row[$root . '.updatedAt']);
        }
        $entity->language = $this->manyToOne($row$root$definition->getField('language')$context);

        $this->translate($definition$entity$row$root$context$definition->getTranslatedFields());
        $this->hydrateFields($definition$entity$root$row$context$definition->getExtensionFields());

        return $entity;
    }
}


        if (isset($row[$root . '.customEntityTypeId'])) {
            $entity->customEntityTypeId = Uuid::fromBytesToHex($row[$root . '.customEntityTypeId']);
        }

        $entity->media = $this->manyToOne($row$root$definition->getField('media')$context);
        $entity->cmsPage = $this->manyToOne($row$root$definition->getField('cmsPage')$context);
        $entity->productStream = $this->manyToOne($row$root$definition->getField('productStream')$context);

        $this->translate($definition$entity$row$root$context$definition->getTranslatedFields());
        $this->hydrateFields($definition$entity$root$row$context$definition->getExtensionFields());
        $this->customFields($definition$row$root$entity$definition->getField('customFields')$context);
        $this->manyToMany($row$root$entity$definition->getField('products'));
        $this->manyToMany($row$root$entity$definition->getField('nestedProducts'));
        $this->manyToMany($row$root$entity$definition->getField('tags'));

        return $entity;
    }
}
public function serialize(Config $config, EntityDefinition $definition$entity): iterable
    {
        if ($entity === null) {
            return;
        }

        if ($entity instanceof Struct) {
            $entity = $entity->jsonSerialize();
        }

        $fields = $definition->getFields();
        $extensionFields = $definition->getExtensionFields();

        foreach ($entity as $key => $value) {
            if ($key === 'extensions') {
                foreach ($value as $extensionKey => $extensionValue) {
                    if (isset($extensionFields[$extensionKey])) {
                        $serializer = $this->serializerRegistry->getFieldSerializer($extensionFields[$extensionKey]);
                        yield from $serializer->serialize($config$extensionFields[$extensionKey]$extensionValue);
                    }
                }

                continue;
            }

        if (isset($row[$root . '.createdAt'])) {
            $entity->createdAt = new \DateTimeImmutable($row[$root . '.createdAt']);
        }
        if (isset($row[$root . '.updatedAt'])) {
            $entity->updatedAt = new \DateTimeImmutable($row[$root . '.updatedAt']);
        }
        $entity->product = $this->manyToOne($row$root$definition->getField('product')$context);
        $entity->language = $this->manyToOne($row$root$definition->getField('language')$context);

        $this->translate($definition$entity$row$root$context$definition->getTranslatedFields());
        $this->hydrateFields($definition$entity$root$row$context$definition->getExtensionFields());

        return $entity;
    }
}

        if (isset($row[$root . '.createdAt'])) {
            $entity->createdAt = new \DateTimeImmutable($row[$root . '.createdAt']);
        }
        if (isset($row[$root . '.updatedAt'])) {
            $entity->updatedAt = new \DateTimeImmutable($row[$root . '.updatedAt']);
        }
        $entity->salesChannel = $this->manyToOne($row$root$definition->getField('salesChannel')$context);
        $entity->product = $this->manyToOne($row$root$definition->getField('product')$context);

        $this->translate($definition$entity$row$root$context$definition->getTranslatedFields());
        $this->hydrateFields($definition$entity$root$row$context$definition->getExtensionFields());

        return $entity;
    }
}

        if (isset($row[$root . '.createdAt'])) {
            $entity->createdAt = new \DateTimeImmutable($row[$root . '.createdAt']);
        }
        if (isset($row[$root . '.updatedAt'])) {
            $entity->updatedAt = new \DateTimeImmutable($row[$root . '.updatedAt']);
        }
        $entity->searchConfig = $this->manyToOne($row$root$definition->getField('searchConfig')$context);
        $entity->customField = $this->manyToOne($row$root$definition->getField('customField')$context);

        $this->translate($definition$entity$row$root$context$definition->getTranslatedFields());
        $this->hydrateFields($definition$entity$root$row$context$definition->getExtensionFields());

        return $entity;
    }
}
Home | Imprint | This part of the site doesn't use cookies.