1 | <?php |
||
21 | class DocumentCursor extends \IteratorIterator |
||
22 | { |
||
23 | /** |
||
24 | * @var Cursor |
||
25 | */ |
||
26 | private $cursor; |
||
27 | |||
28 | /** |
||
29 | * @var string |
||
30 | */ |
||
31 | private $class; |
||
32 | |||
33 | /** |
||
34 | * @var ODMInterface |
||
35 | */ |
||
36 | private $odm; |
||
37 | |||
38 | /** |
||
39 | * @param Cursor $cursor |
||
40 | * @param string $class |
||
41 | * @param ODMInterface $odm |
||
42 | */ |
||
43 | public function __construct(Cursor $cursor, string $class, ODMInterface $odm) |
||
57 | |||
58 | /** |
||
59 | * @return \Spiral\ODM\CompositableInterface |
||
60 | */ |
||
61 | public function current(): CompositableInterface |
||
65 | |||
66 | /** |
||
67 | * @return Cursor |
||
68 | */ |
||
69 | public function getCursor(): Cursor |
||
73 | |||
74 | /** |
||
75 | * @return array |
||
76 | */ |
||
77 | public function toArray(): array |
||
81 | |||
82 | /** |
||
83 | * Fetch all documents. |
||
84 | * |
||
85 | * @return CompositableInterface[] |
||
86 | */ |
||
87 | public function fetchAll(): array |
||
96 | } |