1 | <?php |
||
25 | class Pager extends BasePager |
||
26 | { |
||
27 | /** |
||
28 | * Use separator in CONCAT() function for correct determinate similar records. |
||
29 | */ |
||
30 | public const CONCAT_SEPARATOR = '|'; |
||
31 | |||
32 | /** |
||
33 | * NEXT_MAJOR: remove this property. |
||
34 | * |
||
35 | * @deprecated since sonata-project/doctrine-orm-admin-bundle 2.4 and will be removed in 4.0 |
||
36 | */ |
||
37 | protected $queryBuilder = null; |
||
38 | |||
39 | public function computeNbResult(): int |
||
40 | { |
||
41 | $countQuery = clone $this->getQuery(); |
||
42 | |||
43 | if (\count($this->getParameters()) > 0) { |
||
44 | $countQuery->setParameters($this->getParameters()); |
||
45 | } |
||
46 | |||
47 | if (\count($this->getCountColumn()) > 1) { |
||
48 | $this->countCompositePrimaryKey($countQuery); |
||
49 | } else { |
||
50 | $this->countSinglePrimaryKey($countQuery); |
||
51 | } |
||
52 | |||
53 | return array_sum(array_column( |
||
54 | $countQuery->resetDQLPart('orderBy')->getQuery()->getResult(Query::HYDRATE_SCALAR), |
||
55 | 'cnt' |
||
56 | )); |
||
57 | } |
||
58 | |||
59 | public function getResults($hydrationMode = Query::HYDRATE_OBJECT): array |
||
60 | { |
||
61 | return $this->getQuery()->execute([], $hydrationMode); |
||
62 | } |
||
63 | |||
64 | public function init(): void |
||
88 | |||
89 | private function countCompositePrimaryKey(ProxyQueryInterface $countQuery): void |
||
90 | { |
||
102 | |||
103 | private function countSinglePrimaryKey(ProxyQueryInterface $countQuery): void |
||
112 | } |
||
113 |