1 | <?php |
||
11 | final class ORMQueryResult implements Result |
||
12 | { |
||
13 | private $query; |
||
14 | private $fetchCollection; |
||
15 | private $result; |
||
16 | private $count; |
||
17 | |||
18 | /** |
||
19 | * @param Query|QueryBuilder $query |
||
20 | * @param bool $fetchCollection |
||
21 | */ |
||
22 | 12 | public function __construct($query, $fetchCollection = true) |
|
23 | { |
||
24 | 12 | if ($query instanceof QueryBuilder) { |
|
25 | 6 | $query = $query->getQuery(); |
|
26 | 6 | } |
|
27 | |||
28 | 12 | $this->query = $query; |
|
29 | 12 | $this->fetchCollection = $fetchCollection; |
|
30 | 12 | } |
|
31 | |||
32 | /** |
||
33 | * {@inheritdoc} |
||
34 | */ |
||
35 | 8 | public function take($offset, $limit) |
|
48 | |||
49 | /** |
||
50 | * {@inheritdoc} |
||
51 | */ |
||
52 | 2 | public function count() |
|
60 | |||
61 | /** |
||
62 | * {@inheritdoc} |
||
63 | */ |
||
64 | 2 | public function getIterator() |
|
73 | |||
74 | /** |
||
75 | * @param int $offset |
||
76 | * @param int $limit |
||
77 | * |
||
78 | * @return Paginator |
||
79 | */ |
||
80 | 10 | private function getPaginator($offset, $limit) |
|
93 | } |
||
94 |