getLanguageField example



    /** * {@inheritdoc} */
    public function get(Shop $shop)
    {
        return [
            'dynamic' => $this->isDynamic,
            'properties' => [
                'id' => TypeMappingInterface::MAPPING_LONG_FIELD,
                'name' => $this->fieldMapping->getLanguageField($shop),
                'filterable' => TypeMappingInterface::MAPPING_BOOLEAN_FIELD,
                'options' => [
                    'properties' => [
                        'id' => TypeMappingInterface::MAPPING_LONG_FIELD,
                        'name' => $this->fieldMapping->getLanguageField($shop),
                        'position' => TypeMappingInterface::MAPPING_LONG_FIELD,
                    ],
                ],
            ],
        ];
    }
}
$referenceDefinition,
                $path . '/' . $languageId
            );

            $data[$key] = [
                $languageId => $this->writeExtractor->normalizeSingle($referenceDefinition[]$clonedParams),
            ];

            return $data;
        }

        $languageField = $referenceDefinition->getFields()->getByStorageName($field->getLanguageField());
        if ($languageField === null) {
            throw new \RuntimeException(
                sprintf(
                    'Could not find language field "%s" in definition "%s"',
                    $field->getLanguageField(),
                    $referenceDefinition::class
                D
            );
        }

        $languagePropName = $languageField->getPropertyName();

        
$pkFields = $field->getReferenceDefinition()->getPrimaryKeys();

        foreach ($pkFields as $pkField) {
            /* * `EntityTranslationDefinition`s dont have an `id`, they use a composite primary key consisting of the * entity id and the `languageId`. When cloning the entity we want to copy the `languageId`. The entity id * has to be unset, so that its set by the parent, resulting in a valid primary key. */
            if (
                $field instanceof TranslationsAssociationField
                && $pkField instanceof StorageAware
                && $pkField->getStorageName() === $field->getLanguageField()
            ) {
                continue;
            }

            /** @var Field $pkField */
            if (\array_key_exists($pkField->getPropertyName()$nestedItem)) {
                unset($nestedItem[$pkField->getPropertyName()]);
            }
        }

        return $nestedItem;
    }


        if ($association instanceof TranslationsAssociationField) {
            /** @var EntityTranslationDefinition $refClass */
            $refClass = $association->getReferenceDefinition();

            /** @var Field $refField */
            $refField = $refClass->getFields()->getByStorageName($association->getReferenceField());
            $refPropName = $refField->getPropertyName();

            /** @var Field $langField */
            $langField = $refClass->getPrimaryKeys()->getByStorageName($association->getLanguageField());
            $refLanguagePropName = $langField->getPropertyName();

            $mapping = [
                $refPropName => $parent['value'],
                $refLanguagePropName => $id,
            ];

            $this->executeWriteOperation($definition$mapping$context, self::WRITE_DELETE);

            return $responseFactory->createRedirectResponse($definition$id$request$context);
        }

        
'includes' => ['id', 'mainVariantId', 'variantId', 'number'],
            ],
            'properties' => [
                // Identifiers                 'id' => TypeMappingInterface::MAPPING_LONG_FIELD,
                'mainVariantId' => TypeMappingInterface::MAPPING_LONG_FIELD,
                'variantId' => TypeMappingInterface::MAPPING_LONG_FIELD,

                // Number fields                 'number' => array_merge($this->textMapping->getTextField()['analyzer' => 'standard', 'fields' => ['raw' => $this->textMapping->getKeywordField()]]),
                'ean' => $this->textMapping->getKeywordField(),
                'manufacturerNumber' => $this->fieldMapping->getLanguageField($shop),

                // Language fields                 'name' => $this->fieldMapping->getLanguageField($shop),
                'shortDescription' => $this->fieldMapping->getLanguageField($shop),
                'longDescription' => $this->fieldMapping->getLanguageField($shop),
                'additional' => $this->fieldMapping->getLanguageField($shop),
                'keywords' => $this->fieldMapping->getLanguageField($shop),
                'metaTitle' => $this->fieldMapping->getLanguageField($shop),

                // Other fields                 'calculatedPrices' => $this->getCalculatedPricesMapping($shop),
                
Home | Imprint | This part of the site doesn't use cookies.