File tree Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change 14
14
namespace ApiPlatform \Core \Bridge \Doctrine \Orm ;
15
15
16
16
use ApiPlatform \Core \DataProvider \PaginatorInterface ;
17
+ use Doctrine \ORM \Query ;
17
18
18
19
/**
19
20
* Decorates the Doctrine ORM paginator.
20
21
*
21
22
* @author Kévin Dunglas <[email protected] >
22
23
*/
23
- final class Paginator extends AbstractPaginator implements PaginatorInterface
24
+ final class Paginator extends AbstractPaginator implements PaginatorInterface, QueryAwareInterface
24
25
{
25
26
/**
26
27
* @var int
@@ -46,4 +47,12 @@ public function getTotalItems(): float
46
47
{
47
48
return (float ) ($ this ->totalItems ?? $ this ->totalItems = \count ($ this ->paginator ));
48
49
}
50
+
51
+ /**
52
+ * {@inheritdoc}
53
+ */
54
+ public function getQuery (): Query
55
+ {
56
+ return $ this ->paginator ->getQuery ();
57
+ }
49
58
}
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of the API Platform project.
5
+ *
6
+ * (c) Kévin Dunglas <[email protected] >
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ declare (strict_types=1 );
13
+
14
+ namespace ApiPlatform \Core \Bridge \Doctrine \Orm ;
15
+
16
+ use Doctrine \ORM \Query ;
17
+
18
+ interface QueryAwareInterface
19
+ {
20
+ /**
21
+ * Gets the Query object that will actually be executed.
22
+ *
23
+ * This should allow configuring options which could only be set on the Query
24
+ * object itself.
25
+ */
26
+ public function getQuery (): Query ;
27
+ }
You can’t perform that action at this time.
0 commit comments