Skip to content

Commit

Permalink
Moving code to where it actually belongs
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Sep 22, 2014
1 parent 0c2f466 commit e91831d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/Datasource/QueryTrait.php
Expand Up @@ -413,10 +413,6 @@ protected function _decorateResults($result) {
$result = new $decorator($result);
}

if ($this->bufferResults()) {
$result = new $decorator($result->buffered());
}

return $result;
}

Expand Down
18 changes: 18 additions & 0 deletions src/ORM/Query.php
Expand Up @@ -34,6 +34,7 @@ class Query extends DatabaseQuery implements JsonSerializable {
use QueryTrait {
cache as private _cache;
all as private _all;
_decorateResults as private _applyDecorators;
__call as private _call;
}

Expand Down Expand Up @@ -804,4 +805,21 @@ public function autoFields($value = null) {
return $this;
}

/**
* Decorates the results iterator with MapReduce routines and formatters
*
* @param \Traversable $result Original results
* @return \Cake\Datasource\ResultSetDecorator
*/
protected function _decorateResults($result) {
$result = $this->_applyDecorators($result);

if ($this->bufferResults()) {
$class = $this->_decoratorClass();
$result = new $class($result->buffered());
}

return $result;
}

}

0 comments on commit e91831d

Please sign in to comment.