Skip to content
Permalink
Browse files

this restores SplFixedArray performance op after unserialization

  • Loading branch information...
thinkingmedia
thinkingmedia committed Jan 30, 2017
1 parent 9177f56 commit 434ea311e89a4a95fd06bce60d1cbc20df5b611b
Showing with 5 additions and 4 deletions.
  1. +5 −4 src/ORM/ResultSet.php
@@ -317,7 +317,7 @@ public function serialize()
$this->next();
}
if($this->_results instanceof SplFixedArray) {
if ($this->_results instanceof SplFixedArray) {
return serialize($this->_results->toArray());
}
@@ -334,9 +334,10 @@ public function serialize()
*/
public function unserialize($serialized)
{
$this->_results = (array)(unserialize($serialized) ?: []);
$results = (array)(unserialize($serialized) ?: []);
$this->_results = SplFixedArray::fromArray($results);
$this->_useBuffering = true;
$this->_count = count($this->_results);
$this->_count = $this->_results->count();
}
/**
@@ -355,7 +356,7 @@ public function count()
return $this->_count = $this->_statement->rowCount();
}
if($this->_results instanceof SplFixedArray) {
if ($this->_results instanceof SplFixedArray) {
$this->_count = $this->_results->count();
} else {
$this->_count = count($this->_results);

0 comments on commit 434ea31

Please sign in to comment.
You can’t perform that action at this time.