[BUGFIX] Typo3DBQueryParser fails to wrap subselect in braces 17/52817/2
authorThomas Maroschik <tmaroschik@dfau.de>
Wed, 17 May 2017 10:30:18 +0000 (12:30 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 18 May 2017 12:45:25 +0000 (14:45 +0200)
When the Typo3DBQueryParser converts Extbase queries to Doctrine
queries, it creates subselects for certain relation constraints.
It fails to wrap the subselect in braces for has-many relations
which leads to sql exceptions.

This patch introduces braces around those subselects.

Change-Id: Ie9721a01bf166391770c7a1471272af0e15f9ccb
Fixes: #81240
Releases: master, 8.7
Reviewed-on: https://review.typo3.org/52817
Reviewed-by: Henrik Elsner <helsner@dfau.de>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Jan Helke <typo3@helke.de>
Tested-by: Jan Helke <typo3@helke.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbQueryParser.php

index 03f1a5d..eb3d8fa 100644 (file)
@@ -359,7 +359,7 @@ class Typo3DbQueryParser
                         // Add it to the main query
                         return $this->queryBuilder->expr()->eq(
                             $tableName . '.uid',
-                            $queryBuilderForSubselect->getSQL()
+                            '(' . $queryBuilderForSubselect->getSQL() . ')'
                         );
                     } else {
                         return $this->queryBuilder->expr()->inSet(