[BUGFIX] Extbase distinct query result handling 58/53658/28
authorOliver Hader <oliver@typo3.org>
Mon, 21 Aug 2017 08:13:20 +0000 (10:13 +0200)
committerMorton Jonuschat <m.jonuschat@mojocode.de>
Thu, 24 Aug 2017 15:56:29 +0000 (17:56 +0200)
commitf8aaf85cc5602a45a6f6b949a77ce109bbacc8f8
treebdf0ae50b10bade3ed8bbc7829b4a166145ebfbc
parentc7049ed117866f40e553d99e289816a378c6b295
[BUGFIX] Extbase distinct query result handling

Since Doctrine DBAL has been integrated into the TYPO3 core during
version 8 development and Extbase queries have been adjusted with
TYPO3 version 8.4.0, the behavior on distinct query results were
mixed up as well.

Extbase queries using the query-builder until TYPO3 7 LTS contained a
dedicated `SELECT DISTINCT` when retrieving data which lead to unique
entities, especially when implicit `LEFT JOIN` statements have been
added to the query to resolve cardinalities of the types one-to-many
and many-to-many.

Besides that using `GROUP BY` is not reliable in this particular
Extbase scenario. Further details can be found in MySQL documentation:
https://dev.mysql.com/doc/refman/5.7/en/group-by-handling.html

Change-Id: Ic5fd1d4752eefec7fcff37d8d62f55ea7299e8d6
Resolves: #80380
Releases: master, 8.7
Reviewed-on: https://review.typo3.org/53658
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
17 files changed:
typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php
typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbQueryParser.php
typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example/Classes/Domain/Model/Person.php
typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example/Classes/Domain/Model/Post.php
typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example/Classes/Domain/Repository/PersonRepository.php
typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example/Classes/Domain/Repository/PostRepository.php
typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example/Configuration/TCA/tx_blogexample_domain_model_person.php
typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example/Configuration/TCA/tx_blogexample_domain_model_post.php
typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example/Resources/Private/Language/locallang_db.xml
typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example/ext_tables.sql
typo3/sysext/extbase/Tests/Functional/Persistence/CountTest.php
typo3/sysext/extbase/Tests/Functional/Persistence/Fixtures/persons.xml
typo3/sysext/extbase/Tests/Functional/Persistence/Fixtures/posts.xml
typo3/sysext/extbase/Tests/Functional/Persistence/Fixtures/tags-mm.xml
typo3/sysext/extbase/Tests/Functional/Persistence/Fixtures/tags.xml
typo3/sysext/extbase/Tests/Functional/Persistence/QueryParserTest.php
typo3/sysext/extbase/Tests/Functional/Persistence/RelationTest.php