Bug #87655

Wrong count by extbase with own QueryBuilder

Added by Stefan Froemken over 2 years ago. Updated 9 months ago.

Status:
Accepted
Priority:
Should have
Assignee:
-
Category:
Extbase
Start date:
2019-02-05
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
8
PHP Version:
7.2
Tags:
Complexity:
easy
Is Regression:
Sprint Focus:

Description

Hello Core-Team,

I have created my own Query with QueryBuilder. As I need a relation to categories I have to prevent duplicates through LEFT JOIN. So I have added GROUP BY to my QueryBuilder and give it to $query->statement($myQueryBuilder).

If I call f:count() in fluid on result it should return 13, but it returns 1. That's because of a problem with COUNT and GROUP BY which results in:

COUNT
1
4
2
3
3

This problem is known in extbase. It is solved with help of $suggestDistinctQuery in Typo3DbQueryParser. But in case of an own QueryBuilder object, this property keeps untouched.

I prefer to check own QueryBuilder objects for an existing GROUP BY and set suggestDistinctQuery to true.

Stefan


Related issues

Related to TYPO3 Core - Bug #80464: count() not working correctly in Extbase when using custom statementNew2017-03-27

Actions
Related to TYPO3 Core - Bug #92773: mssql tests fail due to merged patch #87655Closed2020-11-04

Actions

Also available in: Atom PDF