[BUGFIX] List module does not work in workspaces with PostgreSQL 35/52235/3
authorOliver Hader <oliver@typo3.org>
Wed, 29 Mar 2017 10:45:45 +0000 (12:45 +0200)
committerBenni Mack <benni@typo3.org>
Thu, 30 Mar 2017 22:33:29 +0000 (00:33 +0200)
Resolving a move-placeholder in the list-module using PostgreSQL does
not seem to be working and issues an SQL error. Rewriting the logic to
resolve the placeholder using QueryBuilder solves this problem.

Change-Id: Idbce178253cf60f4ef13a45c49fe23e15e26df1f
Resolves: #80550
Releases: master
Reviewed-on: https://review.typo3.org/52235
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php

index 2d0f783..686013f 100644 (file)
@@ -778,21 +778,30 @@ class DatabaseRecordList extends AbstractDatabaseRecordList
                                     // $lRow isn't always what we want - if record was moved we've to work with the
                                     // placeholder records otherwise the list is messed up a bit
                                     if ($row['_MOVE_PLH_uid'] && $row['_MOVE_PLH_pid']) {
-                                        $where = 't3ver_move_id="' . (int)$lRow['uid']
-                                            . '" AND pid="' . (int)$row['_MOVE_PLH_pid']
-                                            . '" AND t3ver_wsid=' . (int)$row['t3ver_wsid'];
-
                                         $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
                                             ->getQueryBuilderForTable($table);
                                         $queryBuilder->getRestrictions()
                                             ->removeAll()
-                                            ->add(GeneralUtility::makeInstance(DeletedRestriction::class))
-                                        ;
+                                            ->add(GeneralUtility::makeInstance(DeletedRestriction::class));
+                                        $predicates = [
+                                            $queryBuilder->expr()->eq(
+                                                't3ver_move_id',
+                                                $queryBuilder->createNamedParameter((int)$lRow['uid'], \PDO::PARAM_INT)
+                                            ),
+                                            $queryBuilder->expr()->eq(
+                                                'pid',
+                                                $queryBuilder->createNamedParameter((int)$row['_MOVE_PLH_pid'], \PDO::PARAM_INT)
+                                            ),
+                                            $queryBuilder->expr()->eq(
+                                                't3ver_wsid',
+                                                $queryBuilder->createNamedParameter((int)$row['t3ver_wsid'], \PDO::PARAM_INT)
+                                            ),
+                                        ];
 
                                         $tmpRow = $queryBuilder
                                             ->select(...$selFieldList)
                                             ->from($table)
-                                            ->where(QueryHelper::stripLogicalOperatorPrefix($where))
+                                            ->andWhere(...$predicates)
                                             ->execute()
                                             ->fetch();