1 | <?php |
||
22 | trait PaginatorTrait |
||
23 | { |
||
24 | /** |
||
25 | * Get configured paginator. |
||
26 | * |
||
27 | * @param AdapterInterface $adapter |
||
28 | * @param int $itemsPerPage |
||
29 | * |
||
30 | * @return Paginator |
||
31 | */ |
||
32 | protected function getPaginator(AdapterInterface $adapter, int $itemsPerPage): Paginator |
||
39 | |||
40 | /** |
||
41 | * Return paginated elements filtered by criteria or throw an exception if none found. |
||
42 | * |
||
43 | * @param array $criteria |
||
44 | * @param array|null $orderBy |
||
45 | * @param int $itemsPerPage |
||
46 | * |
||
47 | * @throws \DomainException |
||
48 | * |
||
49 | * @return Paginator |
||
50 | */ |
||
51 | public function findPaginatedByOrFail(array $criteria, array $orderBy = null, int $itemsPerPage = 10): Paginator |
||
61 | |||
62 | /** |
||
63 | * Return paginated elements filtered by criteria. |
||
64 | * |
||
65 | * @param array $criteria |
||
66 | * @param array|null $orderBy |
||
67 | * @param int $itemsPerPage |
||
68 | * |
||
69 | * @return Paginator |
||
70 | */ |
||
71 | abstract public function findPaginatedBy($criteria, array $orderBy = null, int $itemsPerPage = 10): Paginator; |
||
72 | } |
||
73 |