diff --git a/framework/db/BatchQueryResult.php b/framework/db/BatchQueryResult.php index ad543a0d9c2..8daf9cd084e 100644 --- a/framework/db/BatchQueryResult.php +++ b/framework/db/BatchQueryResult.php @@ -135,6 +135,7 @@ public function next() /** * Fetches the next batch of data. * @return array the data fetched + * @throws Exception */ protected function fetchData() { @@ -142,6 +143,17 @@ protected function fetchData() $this->_dataReader = $this->query->createCommand($this->db)->query(); } + $rows = $this->getRows(); + + return $this->query->populate($rows); + } + + /** + * Reads and collects rows for batch + * @return array + */ + protected function getRows() + { $rows = []; $count = 0; @@ -155,7 +167,7 @@ protected function fetchData() } } - return $this->query->populate($rows); + return $rows; } /**