1 | <?php |
||
16 | { |
||
17 | protected Paginator $paginator; |
||
|
|||
18 | |||
19 | /** |
||
20 | * Constructor |
||
21 | */ |
||
22 | public function __construct(Paginator $paginator) |
||
23 | { |
||
24 | $this->paginator = $paginator; |
||
25 | } |
||
26 | |||
27 | public function setPaginator(Paginator $paginator) : self |
||
28 | { |
||
29 | $this->paginator = $paginator; |
||
30 | } |
||
31 | |||
32 | public function getPaginator() : Paginator |
||
33 | { |
||
34 | return $this->paginator; |
||
35 | } |
||
36 | |||
37 | /** |
||
38 | * {@inheritDoc} |
||
39 | */ |
||
40 | public function getItems($offset, $itemCountPerPage) |
||
41 | { |
||
42 | $this->paginator |
||
43 | ->getQuery() |
||
44 | ->setFirstResult($offset) |
||
45 | ->setMaxResults($itemCountPerPage); |
||
46 | |||
47 | return $this->paginator->getIterator(); |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * {@inheritDoc} |
||
52 | */ |
||
53 | public function count() |
||
54 | { |
||
55 | return $this->paginator->count(); |
||
56 | } |
||
57 | } |
||
58 |