buildTranslationChain example



        $fields = $translationDefinition->getFields();
        if (!empty($partial)) {
            $fields = $translationDefinition->getFields()->filter(fn (Field $field) => $field->is(PrimaryKey::class)
                || isset($partial[$field->getPropertyName()])
                || $field instanceof FkField);
        }

        $inherited = $context->considerInheritance() && $definition->isInheritanceAware();

        $chain = EntityDefinitionQueryHelper::buildTranslationChain($root$context$inherited);

        /** @var TranslatedField $field */
        foreach ($fields as $field) {
            if (!$field instanceof StorageAware) {
                continue;
            }

            $selects = [];
            foreach ($chain as $select) {
                $vars = [
                    '#root#' => $select,
                    
$this->customFields($definition$row$root$entity$field$context);

                continue;
            }

            if ($field instanceof TranslatedField) {
                // contains the resolved translation chain value                 $decoded = $typed->getSerializer()->decode($typed$value);
                $entity->addTranslated($property$decoded);

                $inherited = $definition->isInheritanceAware() && $context->considerInheritance();
                $chain = EntityDefinitionQueryHelper::buildTranslationChain($root$context$inherited);

                // assign translated value of the first language                 $key = array_shift($chain) . '.' . $property;

                $decoded = $typed->getSerializer()->decode($typed$row[$key]);
                $entity->assign([$property => $decoded]);

                continue;
            }

            $decoded = $definition->decode($property$value);

            
Home | Imprint | This part of the site doesn't use cookies.