Skip to content
Snippets Groups Projects
Commit 4b27d3e7 authored by Georg Ringer's avatar Georg Ringer Committed by Christian Kuhn
Browse files

[FOLLOWUP][TASK] Doctrine: Migrate \TYPO3\CMS\Frontend\Page\PageRepository

The sorting field is optional and an empty field leads
to an invalid  query.

Resolves: #76543
Releases: master
Change-Id: I7e4e6c7ea873891b43d428d4db4a2d7ca63dc390
Reviewed-on: https://review.typo3.org/49456


Tested-by: default avatarBamboo TYPO3com <info@typo3.com>
Reviewed-by: default avatarMathias Schreiber <mathias.schreiber@wmdb.de>
Tested-by: default avatarMathias Schreiber <mathias.schreiber@wmdb.de>
Reviewed-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
parent 5be00495
Branches
Tags
No related merge requests found
...@@ -697,16 +697,19 @@ class PageRepository ...@@ -697,16 +697,19 @@ class PageRepository
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages'); $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages');
$queryBuilder->getRestrictions()->removeAll(); $queryBuilder->getRestrictions()->removeAll();
$result = $queryBuilder->select(...GeneralUtility::trimExplode(',', $fields, true)) $res = $queryBuilder->select(...GeneralUtility::trimExplode(',', $fields, true))
->from('pages') ->from('pages')
->where( ->where(
$queryBuilder->expr()->in($relationField, array_map('intval', $pageIds)), $queryBuilder->expr()->in($relationField, array_map('intval', $pageIds)),
QueryHelper::stripLogicalOperatorPrefix($this->where_hid_del), QueryHelper::stripLogicalOperatorPrefix($this->where_hid_del),
QueryHelper::stripLogicalOperatorPrefix($this->where_groupAccess), QueryHelper::stripLogicalOperatorPrefix($this->where_groupAccess),
QueryHelper::stripLogicalOperatorPrefix($additionalWhereClause) QueryHelper::stripLogicalOperatorPrefix($additionalWhereClause)
) );
->orderBy($sortField)
->execute(); if (!empty($sortField)) {
$res->orderBy($sortField);
}
$result = $res->execute();
while ($page = $result->fetch()) { while ($page = $result->fetch()) {
$originalUid = $page['uid']; $originalUid = $page['uid'];
......
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