Total Complexity | 4 |
Total Lines | 46 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
19 | class DoctrineMongoLateAdapter implements AdapterInterface |
||
20 | { |
||
21 | /** |
||
22 | * @var QueryBuilder |
||
23 | */ |
||
24 | private QueryBuilder $queryBuilder; |
||
25 | |||
26 | /** |
||
27 | * @var AbstractPaginationQuery |
||
28 | */ |
||
29 | private AbstractPaginationQuery $filter; |
||
30 | |||
31 | private array $params; |
||
32 | |||
33 | /** |
||
34 | * @param QueryBuilder $queryBuilder |
||
35 | * @param AbstractPaginationQuery $filter |
||
36 | * @param array $params |
||
37 | */ |
||
38 | public function __construct(QueryBuilder $queryBuilder, AbstractPaginationQuery $filter, $params = array()) |
||
39 | { |
||
40 | $this->queryBuilder = $queryBuilder; |
||
41 | $this->filter = $filter; |
||
42 | $this->params = $params; |
||
43 | } |
||
44 | |||
45 | public function getItems($offset, $itemCountPerPage) |
||
46 | { |
||
47 | try { |
||
48 | $qb = $this->queryBuilder; |
||
49 | $qb->skip($offset)->limit($itemCountPerPage); |
||
50 | return $qb->getQuery()->toArray(); |
||
51 | }catch (\Exception $e){ |
||
52 | throw $e; |
||
53 | } |
||
54 | } |
||
55 | |||
56 | /** |
||
57 | * @return int |
||
58 | * @throws \Doctrine\ODM\MongoDB\MongoDBException |
||
59 | * FIXME: count method for ODM Module 3 |
||
60 | */ |
||
61 | public function count() |
||
65 | } |
||
66 | |||
67 | } |