Commit f3e7a034 authored by Wolfgang Klinger's avatar Wolfgang Klinger Committed by Wouter Wolters
Browse files

[BUGFIX] Fix foreign_table_where GROUP BY handling

Unpack the array elements before passing them on

Resolves: #82159
Releases: master, 8.7
Change-Id: I6a094927f595d42fc15bb96a9dbc1d313a7808b0
Reviewed-on: https://review.typo3.org/54473

Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Markus Klein's avatarMarkus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein's avatarMarkus Klein <markus.klein@typo3.org>
Reviewed-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
parent 74d0b919
......@@ -943,6 +943,7 @@ abstract class AbstractItemProvider
$foreignTableClauseArray = $this->processForeignTableClause($result, $foreignTableName, $localFieldName);
$fieldList = BackendUtility::getCommonSelectFields($foreignTableName, $foreignTableName . '.');
/** @var QueryBuilder $queryBuilder */
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
->getQueryBuilderForTable($foreignTableName);
......@@ -956,7 +957,7 @@ abstract class AbstractItemProvider
->where($foreignTableClauseArray['WHERE']);
if (!empty($foreignTableClauseArray['GROUPBY'])) {
$queryBuilder->groupBy($foreignTableClauseArray['GROUPBY']);
$queryBuilder->groupBy(...$foreignTableClauseArray['GROUPBY']);
}
if (!empty($foreignTableClauseArray['ORDERBY'])) {
......
......@@ -1754,7 +1754,7 @@ class TcaSelectItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
'foreign_table' => 'fTable',
'foreign_table_where' => '
AND ftable.uid=1
GROUP BY groupField
GROUP BY groupField1, groupField2
ORDER BY orderField
LIMIT 1,2',
],
......@@ -1779,7 +1779,7 @@ class TcaSelectItemsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
$queryBuilderProphet->select('fTable.uid')->shouldBeCalled()->willReturn($queryBuilderProphet->reveal());
$queryBuilderProphet->from('fTable')->shouldBeCalled()->willReturn($queryBuilderProphet->reveal());
$queryBuilderProphet->from('pages')->shouldBeCalled()->willReturn($queryBuilderProphet->reveal());
$queryBuilderProphet->groupBy(['groupField'])->shouldBeCalled()->willReturn($queryBuilderProphet->reveal());
$queryBuilderProphet->groupBy('groupField1', 'groupField2')->shouldBeCalled()->willReturn($queryBuilderProphet->reveal());
$queryBuilderProphet->addOrderBy('orderField', null)->shouldBeCalled()->willReturn($queryBuilderProphet->reveal());
$queryBuilderProphet->setFirstResult(1)->shouldBeCalled()->willReturn($queryBuilderProphet->reveal());
$queryBuilderProphet->setMaxResults(2)->shouldBeCalled()->willReturn($queryBuilderProphet->reveal());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment