Skip to content

Commit c88a6e2

Browse files
committed
Merge pull request #5 from m0ppers/master
arrays vs. documents
2 parents 5ff0f09 + 0af1daa commit c88a6e2

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lib/triagens/ArangoDb/Cursor.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,19 @@ public function __construct(Connection $connection, array $data, array $options)
104104
$this->_hasMore = (bool) $data[self::ENTRY_HASMORE];
105105

106106
$this->_options = $options;
107-
$this->_result = $this->sanitize((array) $data[self::ENTRY_RESULT]);
107+
$this->_result = array();
108+
$this->addDocumentsFromArray((array) $data[self::ENTRY_RESULT]);
108109
$this->updateLength();
109110

110111
$this->rewind();
111112
}
113+
114+
private function addDocumentsFromArray(array $data)
115+
{
116+
foreach ($this->sanitize($data) as $row) {
117+
$this->_result[] = Document::createFromArray($row);
118+
}
119+
}
112120

113121
/**
114122
* Explicitly delete the cursor
@@ -254,7 +262,7 @@ private function fetchOutstanding() {
254262
$data = $response->getJson();
255263

256264
$this->_hasMore = (bool) $data[self::ENTRY_HASMORE];
257-
$this->_result = array_merge($this->_result, $this->sanitize((array) $data[self::ENTRY_RESULT]));
265+
$this->addDocumentsFromArray($data[self::ENTRY_RESULT]);
258266

259267
if (!$this->_hasMore) {
260268
// we have fetch the complete result set and can unset the id now

0 commit comments

Comments
 (0)