Project

General

Profile

Bug #81208 » 81208_v9.5.diff

Markus Hackel, 2020-04-27 13:09

View differences:

typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php
{
if ($source instanceof Qom\SelectorInterface) {
$tableName = $source->getSelectorName();
$forceRecordReloadInWorkspace = false;
} elseif ($source instanceof Qom\JoinInterface) {
$tableName = $source->getRight()->getSelectorName();
$forceRecordReloadInWorkspace = true;
} else {
// No proper source, so we do not have a table name here
// we cannot do an overlay and return the original rows instead.
......
{
if ($source instanceof Qom\SelectorInterface) {
$tableName = $source->getSelectorName();
$forceRecordReloadInWorkspace = false;
} elseif ($source instanceof Qom\JoinInterface) {
$tableName = $source->getRight()->getSelectorName();
$forceRecordReloadInWorkspace = true;
} else {
// No proper source, so we do not have a table name here
// we cannot do an overlay and return the original rows instead.
......
// by the table and if there's only one row in the result set
// (applying this to all rows does not work, since the sorting
// order would be destroyed and possible limits not met anymore)
if (!empty($workspaceUid)
&& BackendUtility::isTableWorkspaceEnabled($tableName)
&& count($rows) === 1
) {
$isInWorkspaceContext = !empty($workspaceUid)
&& BackendUtility::isTableWorkspaceEnabled($tableName);
if ($isInWorkspaceContext && count($rows) === 1) {
$versionId = $workspaceUid;
$queryBuilder = $this->connectionPool->getQueryBuilderForTable($tableName);
$queryBuilder->getRestrictions()->removeAll();
......
->fetchAll();
if (!empty($movePlaceholder)) {
$rows = $movePlaceholder;
// Records have been "reloaded"
$forceRecordReloadInWorkspace = false;
}
}
$overlaidRows = [];
foreach ($rows as $row) {
$originalRow = $row;
// If current row is a translation or we are in a workspace preview, select its parent
if (isset($tableName) && isset($GLOBALS['TCA'][$tableName])
&& isset($GLOBALS['TCA'][$tableName]['ctrl']['languageField'])
&& isset($GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField'])
&& isset($row[$GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField']])
&& (
$row[$GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField']] > 0
|| ($forceRecordReloadInWorkspace && $isInWorkspaceContext)
)
) {
$queryBuilder = $this->connectionPool->getQueryBuilderForTable($tableName);
$queryBuilder->getRestrictions()->removeAll();
$row = $queryBuilder
->select($tableName . '.*')
->from($tableName)
->where(
$queryBuilder->expr()->eq(
$tableName . '.uid',
$queryBuilder->createNamedParameter(
$row[$GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField']] == 0 ? $row['uid'] : $row[$GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField']],
\PDO::PARAM_INT
)
),
$queryBuilder->expr()->eq(
$tableName . '.' . $GLOBALS['TCA'][$tableName]['ctrl']['languageField'],
$queryBuilder->createNamedParameter(
0,
\PDO::PARAM_INT
)
)
)
->setMaxResults(1)
->execute()
->fetch();
}
$pageRepository->versionOL($tableName, $row, true);
$querySettings = $query->getQuerySettings();
if (is_array($row) && $querySettings->getLanguageOverlayMode()) {
......
}
}
if ($row !== null && is_array($row)) {
if ($forceRecordReloadInWorkspace && $isInWorkspaceContext) {
// Add additional fields back to the overlaid record
$row = array_merge($originalRow, $row);
}
$overlaidRows[] = $row;
}
}
(5-5/5)