Total Complexity | 5 |
Total Lines | 36 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 0 |
1 | <?php |
||
6 | trait DbalPaginatorCapabilities |
||
7 | { |
||
8 | protected function findAll(): array |
||
9 | { |
||
10 | if (null !== $this->limit) { |
||
11 | $this->qb->setMaxResults($this->limit); |
||
12 | } |
||
13 | $this->qb->setFirstResult($this->offset); |
||
14 | |||
15 | return $this->qb->execute()->fetchAll(); |
||
16 | } |
||
17 | |||
18 | protected function getTotal(): int |
||
19 | { |
||
20 | $qb = clone $this->qb; |
||
21 | $countFrom = $this->getCountFrom(); |
||
22 | |||
23 | $qb->select("COUNT($countFrom)") |
||
24 | ->setMaxResults(null) |
||
25 | ->setFirstResult(null) |
||
26 | ->resetQueryPart('orderBy'); |
||
27 | |||
28 | return (int) $qb->execute()->fetchColumn(); |
||
29 | } |
||
30 | |||
31 | protected function getCountFrom(): string |
||
42 | } |
||
43 | } |
||
44 |