[BUGFIX] Fix count for custom queries with group by statement
When using the extbase persistence and setting a custom query with group by statements via $query->statement($statement), calling $query->execute()->count() did not return the right amount of records. Instead the database backend chose the first column of one of the returned records which resulted in the count of a subset of grouped records. To fix this, the database backend needs to build a count query with a distinct statement on all fields that are used for the grouping. Resolves: #87655 Releases: master, 10.4 Change-Id: Ia7ad4535a39f5b285efd9249807b5ddd4725b90c Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/59641 Tested-by:TYPO3com <noreply@typo3.com> Tested-by:
Rémy DANIEL <dogawaf@no-log.org> Tested-by:
Benni Mack <benni@typo3.org> Reviewed-by:
Rémy DANIEL <dogawaf@no-log.org> Reviewed-by:
Benni Mack <benni@typo3.org>
Showing
- typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php 20 additions, 3 deletions...se/Classes/Persistence/Generic/Storage/Typo3DbBackend.php
- typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbQueryParser.php 9 additions, 1 deletion...lasses/Persistence/Generic/Storage/Typo3DbQueryParser.php
- typo3/sysext/extbase/Tests/Functional/Persistence/CountTest.php 63 additions, 0 deletions...sysext/extbase/Tests/Functional/Persistence/CountTest.php
- typo3/sysext/extbase/Tests/Unit/Persistence/Generic/Storage/Typo3DbQueryParserTest.php 54 additions, 0 deletions...it/Persistence/Generic/Storage/Typo3DbQueryParserTest.php