Project

General

Profile

Bug #92442 » typo3_extbase_fix_localized_record_preview.patch

Rémy DANIEL, 2020-09-29 13:12

View differences:

sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbQueryParser.php 2020-09-29 13:00:41.719593256 +0200 → sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbQueryParser.php 2020-09-29 12:45:52.959000000 +0200
use TYPO3\CMS\Core\Database\Query\Expression\ExpressionBuilder;
use TYPO3\CMS\Core\Database\Query\QueryBuilder;
use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
use TYPO3\CMS\Core\Database\Query\Restriction\FrontendRestrictionContainer;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
use TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject;
......
if ($typeOfRelation === ColumnMap::RELATION_HAS_AND_BELONGS_TO_MANY) {
$relationTableName = $columnMap->getRelationTableName();
$queryBuilderForSubselect = $this->queryBuilder->getConnection()->createQueryBuilder();
if ($this->environmentService->isEnvironmentInFrontendMode()) {
$queryBuilderForSubselect->setRestrictions(GeneralUtility::makeInstance(FrontendRestrictionContainer::class));
}
$queryBuilderForSubselect
->select($columnMap->getParentKeyFieldName())
->from($relationTableName)
......
// Build the SQL statement of the subselect
$queryBuilderForSubselect = $this->queryBuilder->getConnection()->createQueryBuilder();
if ($this->environmentService->isEnvironmentInFrontendMode()) {
$queryBuilderForSubselect->setRestrictions(GeneralUtility::makeInstance(FrontendRestrictionContainer::class));
}
$queryBuilderForSubselect
->select($parentKeyFieldName)
->from($childTableName)
......
$defLangTableAlias = $tableAlias . '_dl';
$defaultLanguageRecordsSubSelect = $this->queryBuilder->getConnection()->createQueryBuilder();
if ($this->environmentService->isEnvironmentInFrontendMode()) {
$defaultLanguageRecordsSubSelect->setRestrictions(GeneralUtility::makeInstance(FrontendRestrictionContainer::class));
}
$defaultLanguageRecordsSubSelect
->select($defLangTableAlias . '.uid')
->from($tableName, $defLangTableAlias)
......
// together with not translated default language records
$translatedOnlyTableAlias = $tableAlias . '_to';
$queryBuilderForSubselect = $this->queryBuilder->getConnection()->createQueryBuilder();
if ($this->environmentService->isEnvironmentInFrontendMode()) {
$queryBuilderForSubselect->setRestrictions(GeneralUtility::makeInstance(FrontendRestrictionContainer::class));
}
$queryBuilderForSubselect
->select($translatedOnlyTableAlias . '.' . $transOrigPointerField)
->from($tableName, $translatedOnlyTableAlias)
(1-1/4)