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 #1

Updated by Jarvis H almost 6 years ago

  • Description updated (diff)
Actions #2

Updated by Riccardo De Contardi almost 6 years ago

  • Category set to Localization
Actions #3

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

Actions #4

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

Actions #5

Updated by Benni Mack over 5 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #6

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF