File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -43,3 +43,18 @@ the future.
43
43
.. note ::
44
44
45
45
``fetchJoinCollection `` argument set to ``true `` might affect results if you use aggregations in your query.
46
+
47
+ By using the ``Paginator::HINT_ENABLE_DISTINCT `` you can instruct doctrine that the query to be executed
48
+ will not produce "duplicate" rows (only to-one relations are joined), thus the SQL limit will work as expected.
49
+ In this way the `DISTINCT ` keyword will be omitted and can bing important performance improvements.
50
+
51
+ .. code-block :: php
52
+
53
+ <?php
54
+ use Doctrine\ORM\Tools\Pagination\Paginator;
55
+
56
+ $dql = "SELECT u, p FROM User u JOIN u.mainPicture p";
57
+ $query = $entityManager->createQuery($dql)
58
+ ->setHint(Paginator::HINT_ENABLE_DISTINCT, false)
59
+ ->setFirstResult(0)
60
+ ->setMaxResults(100);
You can’t perform that action at this time.
0 commit comments