1 | <?php |
||
23 | class Pager extends BasePager |
||
24 | { |
||
25 | /** |
||
26 | * NEXT_MAJOR: remove this property. |
||
27 | * |
||
28 | * @deprecated This property is deprecated since version 2.4 and will be removed in 3.0 |
||
29 | */ |
||
30 | protected $queryBuilder = null; |
||
31 | |||
32 | public function computeNbResult() |
||
33 | { |
||
34 | $countQuery = clone $this->getQuery(); |
||
35 | |||
36 | if (count($this->getParameters()) > 0) { |
||
37 | $countQuery->setParameters($this->getParameters()); |
||
38 | } |
||
39 | |||
40 | $query = $countQuery->getQuery(); |
||
41 | $isDistinct = $countQuery instanceof ProxyQuery ? $countQuery->isDistinct() : true; |
||
42 | $query->setHint(CountWalker::HINT_DISTINCT, $isDistinct); |
||
43 | $this->appendTreeWalker($query, CountWalker::class); |
||
44 | |||
45 | return $query->getSingleScalarResult(); |
||
46 | } |
||
47 | |||
48 | public function getResults($hydrationMode = Query::HYDRATE_OBJECT) |
||
52 | |||
53 | public function getQuery() |
||
57 | |||
58 | public function init() |
||
82 | |||
83 | /** |
||
84 | * Appends a custom tree walker to the tree walkers hint. |
||
85 | * |
||
86 | * @param Query $query |
||
87 | * @param string $walkerClass |
||
88 | */ |
||
89 | private function appendTreeWalker(Query $query, $walkerClass) |
||
100 | } |
||
101 |