Skip to content
Permalink
Browse files

Add Cake\Database\Query::disableBufferedResults().

  • Loading branch information...
ADmad committed Nov 1, 2018
1 parent 1a91ee7 commit 631e7df6a514a48eab42ea5ac3d043ffeb8ce7b4
Showing with 18 additions and 2 deletions.
  1. +16 −0 src/Database/Query.php
  2. +2 −2 src/ORM/Behavior/TranslateBehavior.php
@@ -2069,6 +2069,22 @@ public function enableBufferedResults($enable = true)
return $this;
}
/**
* Disables buffered results.
*
* Disabling buffering will consume less memory as fetched results are not
* remembered for future iterations.
*
* @return $this
*/
public function disableBufferedResults()
{
$this->_dirty();
$this->_useBufferedResults = false;
return $this;
}
/**
* Returns whether buffered results are enabled/disabled.
*
@@ -334,7 +334,7 @@ public function beforeSave(Event $event, EntityInterface $entity, ArrayObject $o
'foreign_key' => $key,
'model' => $model
])
->enableBufferedResults(false)
->disableBufferedResults()
->all()
->indexBy('field');
@@ -753,7 +753,7 @@ protected function _findExistingTranslations($ruleSet)
->select(['id', 'num' => 0])
->where(current($ruleSet))
->disableHydration()
->enableBufferedResults(false);
->disableBufferedResults();
unset($ruleSet[0]);
foreach ($ruleSet as $i => $conditions) {

0 comments on commit 631e7df

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