Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Add buffer handling to HydratingResultSet #2807

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 12 additions & 2 deletions library/Zend/Db/ResultSet/HydratingResultSet.php
Expand Up @@ -90,9 +90,19 @@ public function getHydrator()
*/
public function current()
{
if ($this->buffer === null) {
$this->buffer = -2; // implicitly disable buffering from here on
} elseif (is_array($this->buffer) && isset($this->buffer[$this->position])) {
return $this->buffer[$this->position];
}
$data = $this->dataSource->current();
$object = clone $this->objectPrototype;
return is_array($data) ? $this->hydrator->hydrate($data, $object) : false;
$object = is_array($data) ? $this->hydrator->hydrate($data, clone $this->objectPrototype) : false;

if (is_array($this->buffer)) {
$this->buffer[$this->position] = $object;
}

return $object;
}

/**
Expand Down