@@ 103-110 (lines=8) @@ | ||
100 | $iterator = new \IteratorIterator($cursor); |
|
101 | $iterator->rewind(); |
|
102 | $results=[]; |
|
103 | while ($doc = $iterator->current()) { |
|
104 | if (isset($doc['_id'])) { |
|
105 | $doc['id'] = (string) $doc['_id']; |
|
106 | unset($doc['_id']); |
|
107 | } |
|
108 | $results[$doc['id']] = $doc; |
|
109 | $iterator->next(); |
|
110 | } |
|
111 | return $results; |
|
112 | } |
|
113 | ||
@@ 193-200 (lines=8) @@ | ||
190 | $cursor = $collection->find($query_filters, $options); |
|
191 | $iterator = new \IteratorIterator($cursor); |
|
192 | $iterator->rewind(); |
|
193 | while ($doc = $iterator->current()) { |
|
194 | if (isset($doc['_id'])) { |
|
195 | $doc['id'] = (string) $doc['_id']; |
|
196 | unset($doc['_id']); |
|
197 | } |
|
198 | $results[] = $doc; |
|
199 | $iterator->next(); |
|
200 | } |
|
201 | return ['total' => $count, 'data' => $results]; |
|
202 | } |
|
203 | return ['total' => 0, 'data' => null]; |