[BUGFIX] Extbase distinct query result handling 70/53670/5
authorOliver Hader <oliver@typo3.org>
Mon, 21 Aug 2017 08:13:20 +0000 (10:13 +0200)
committerOliver Hader <oliver.hader@typo3.org>
Thu, 24 Aug 2017 18:48:57 +0000 (20:48 +0200)
commit5c249c6732c94e10028a806aedc69838e24b61de
tree0af4d64eaf8d26bc87109f8212d7b13e505a2582
parent70bcd648fe56e2438743768dd76325b068acfa82
[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>
(cherry picked from commit f8aaf85cc5602a45a6f6b949a77ce109bbacc8f8)
Reviewed-on: https://review.typo3.org/53670
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Tested-by: Oliver Hader <oliver.hader@typo3.org>
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