1 | <?php |
||
12 | class Driver implements BaseDriver |
||
13 | { |
||
14 | /** |
||
15 | * @var MongoDBClient |
||
16 | */ |
||
17 | private $connection; |
||
18 | |||
19 | /** |
||
20 | * @var Database |
||
21 | */ |
||
22 | private $database; |
||
23 | |||
24 | /** |
||
25 | * Driver constructor. |
||
26 | * |
||
27 | * @param MongoDBClient $connection |
||
28 | * @param string $database |
||
29 | */ |
||
30 | 4 | public function __construct(MongoDBClient $connection, $database) |
|
35 | |||
36 | /** |
||
37 | * @return Database |
||
38 | */ |
||
39 | public function getDatabase() |
||
43 | |||
44 | /** |
||
45 | * @return MongoDBClient |
||
46 | */ |
||
47 | public function getConnection() |
||
51 | |||
52 | /** |
||
53 | * @param \Iterator $cursor |
||
54 | * |
||
55 | * @return array |
||
56 | */ |
||
57 | public function fetch(\Iterator $cursor) |
||
67 | |||
68 | /** |
||
69 | * @param array $collection |
||
70 | * @param array $query |
||
71 | * |
||
72 | * @return \Iterator |
||
73 | */ |
||
74 | public function find($collection, array $query = []) |
||
82 | |||
83 | /** |
||
84 | * @param Collection $collection |
||
85 | * |
||
86 | * @return array |
||
87 | */ |
||
88 | 3 | public function generateQuery(Collection $collection) |
|
92 | |||
93 | /** |
||
94 | * @param Collection $collection |
||
95 | * |
||
96 | * @return array |
||
97 | */ |
||
98 | 3 | protected function parseConditions(Collection $collection) |
|
112 | |||
113 | /** |
||
114 | * @param Collection $collection |
||
115 | * @param bool|false $prefix |
||
116 | * |
||
117 | * @return array |
||
118 | */ |
||
119 | 3 | protected function getConditionArray(Collection $collection, $prefix = false) |
|
133 | |||
134 | /** |
||
135 | * @param array $array |
||
136 | * @param string $prefix |
||
137 | * |
||
138 | * @return array |
||
139 | */ |
||
140 | 1 | protected static function prefixArrayKeys(array $array, $prefix) |
|
150 | |||
151 | /** |
||
152 | * @param Collection $collection |
||
153 | * @param $document |
||
154 | * |
||
155 | * @return void |
||
156 | */ |
||
157 | public function insert($collection, $document) |
||
162 | |||
163 | public function update($collection, $criteria, $document) |
||
167 | |||
168 | /** |
||
169 | * @param string $collection |
||
170 | * @param array $criteria |
||
171 | */ |
||
172 | public function remove($collection, $criteria) |
||
176 | } |
||
177 |