From 4bee9a4ed9d4270efd55da7a5209f34a011ddeed Mon Sep 17 00:00:00 2001 From: Alexander Kartavenko Date: Mon, 15 Jul 2019 14:49:11 +0300 Subject: [PATCH] #10023. Fix codeclimate issue --- framework/db/BatchQueryResult.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/framework/db/BatchQueryResult.php b/framework/db/BatchQueryResult.php index ad543a0..8daf9cd 100644 --- a/framework/db/BatchQueryResult.php +++ b/framework/db/BatchQueryResult.php @@ -135,6 +135,7 @@ class BatchQueryResult extends BaseObject implements \Iterator /** * Fetches the next batch of data. * @return array the data fetched + * @throws Exception */ protected function fetchData() { @@ -142,6 +143,17 @@ class BatchQueryResult extends BaseObject implements \Iterator $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 @@ class BatchQueryResult extends BaseObject implements \Iterator } } - return $this->query->populate($rows); + return $rows; } /**