buildFieldSelector example

/** * @param list<string> $chain */
    private function getTranslationFieldAccessor(Field $field, string $accessor, array $chain, Context $context): string
    {
        if (!$field instanceof StorageAware) {
            throw new \RuntimeException('Only storage aware fields are supported as translated field');
        }

        $selects = [];
        foreach ($chain as $part) {
            $select = $this->buildFieldSelector($part$field$context$accessor);

            $selects[] = str_replace(
                '`.' . self::escape($field->getStorageName()),
                '.' . $field->getPropertyName() . '`',
                $select
            );
        }

        /* * Simplified Example: * COALESCE( JSON_UNQUOTE(JSON_EXTRACT(`tbl.translation.fallback_2`.`translated_attributes`, '$.path')) AS datetime(3), # child language JSON_UNQUOTE(JSON_EXTRACT(`tbl.translation.fallback_1`.`translated_attributes`, '$.path')) AS datetime(3), # root language JSON_UNQUOTE(JSON_EXTRACT(`tbl.translation`.`translated_attributes`, '$.path')) AS datetime(3) # system language ); */
Home | Imprint | This part of the site doesn't use cookies.