| 1 | <?php |
||
| 9 | use Pagerfanta\Adapter\AdapterInterface; |
||
| 10 | |||
| 11 | abstract class BaseAdapter implements AdapterInterface |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * @var \Netgen\InformationCollection\API\Service\InformationCollection |
||
| 15 | */ |
||
| 16 | protected $informationCollectionService; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @var \Netgen\InformationCollection\API\Value\Filter\Query |
||
| 20 | */ |
||
| 21 | protected $query; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * InformationCollectionCollectionListAdapter constructor. |
||
| 25 | * |
||
| 26 | * @param \Netgen\InformationCollection\API\Service\InformationCollection $informationCollectionService |
||
| 27 | * @param \Netgen\InformationCollection\API\Value\Filter\Query $query |
||
| 28 | */ |
||
| 29 | public function __construct(InformationCollection $informationCollectionService, Query $query) |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @param int $offset |
||
| 37 | * @param int $length |
||
| 38 | * |
||
| 39 | * @return \Netgen\InformationCollection\API\Value\Filter\Query |
||
| 40 | */ |
||
| 41 | protected function getQuery($offset, $length) |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @return \Netgen\InformationCollection\API\Value\Filter\Query |
||
| 52 | */ |
||
| 53 | protected function getCountQuery() |
||
| 54 | { |
||
| 55 | $query = clone $this->query; |
||
| 56 | $query->limit = Query::COUNT_QUERY; |
||
| 57 | |||
| 58 | return $query; |
||
| 59 | } |
||
| 61 |