Bug #87521
closedl10n_parent is ambiguous in where clause in contentObjectRenderer->getLanguageRestriction()
100%
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.
Updated by Gerrit Code Review over 5 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60430
Updated by Gerrit Code Review over 5 years ago
Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60448
Updated by Benni Mack over 5 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 3fe30c4130ef5774ee6e4892d05c16553266a4ae.