Project

General

Profile

Actions

Bug #87521

closed

l10n_parent is ambiguous in where clause in contentObjectRenderer->getLanguageRestriction()

Added by Jarvis H almost 6 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Localization
Target version:
-
Start date:
2019-01-22
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
9
PHP Version:
7.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

What causes the error:

In order to ensure correct sorting of gridelements-children in the Menu Section element I used the Typoscript found below.
Basically joining tt_content on tt_content will cause an error reading "Column 'l18n_parent' in where clause is ambiguous".

tt_content.menu_section {
    dataProcessing {
        10 {
            dataProcessing {
                20 {

                    # Adjust query params in dataProcessor for correct
                    # sorting of elements inside grids
                    table = tt_content
                    selectFields = tt_content.*, COALESCE(tt2.sorting, tt_content.sorting) AS sort
                    pidInList.field = uid
                    as = content
                    where = tt_content.sectionIndex = 1
                    leftjoin = tt_content AS tt2 ON tt2.uid = tt_content.tx_gridelements_container
                    orderBy = sort ASC
                }
            }
        }
    }
}

Possible solution:

In the class TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer and function getLanguageRestriction() adjusting the following part starting on line 7032:

if ($includeRecordsWithoutDefaultTranslation) {
    $languageQuery = $expressionBuilder->orX(
        $languageQuery,
        $expressionBuilder->andX(
            $expressionBuilder->eq($localizationParentField, 0),
            $expressionBuilder->eq($languageField, $languageAspect->getContentId())
         )
    );
}

to this:

if ($includeRecordsWithoutDefaultTranslation) {
    $languageQuery = $expressionBuilder->orX(
        $languageQuery,
        $expressionBuilder->andX(
            // add $table prefix to $localizationParentField
            $expressionBuilder->eq($table . '.' . $localizationParentField, 0),
            $expressionBuilder->eq($languageField, $languageAspect->getContentId())
         )
    );
}

solves the issue for me.

Actions

Also available in: Atom PDF