Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions lib/triagens/ArangoDb/Cursor.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,19 @@ public function __construct(Connection $connection, array $data, array $options)
$this->_hasMore = (bool) $data[self::ENTRY_HASMORE];

$this->_options = $options;
$this->_result = $this->sanitize((array) $data[self::ENTRY_RESULT]);
$this->_result = array();
$this->addDocumentsFromArray((array) $data[self::ENTRY_RESULT]);
$this->updateLength();

$this->rewind();
}

private function addDocumentsFromArray(array $data)
{
foreach ($this->sanitize($data) as $row) {
$this->_result[] = Document::createFromArray($row);
}
}

/**
* Explicitly delete the cursor
Expand Down Expand Up @@ -254,7 +262,7 @@ private function fetchOutstanding() {
$data = $response->getJson();

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

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