getTranslationField example

$lastAssociationField = $fields[\count($fields) - 1];

            $path = array_map(fn (Field $field) => $field->getPropertyName()$fields);

            $association = implode('.', $path);
            if ($criteria->hasAssociation($association)) {
                continue;
            }

            $criteria->addAssociation($association);

            $translationField = $lastAssociationField->getReferenceDefinition()->getTranslationField();
            if (!$translationField) {
                continue;
            }

            // filter the associations that have no translations in given language,             // as we automatically use the parent languages keywords for those             $translationLanguageAccessor = sprintf(
                '%s.%s.languageId',
                $association,
                $translationField->getPropertyName()
            );
            
Home | Imprint | This part of the site doesn't use cookies.