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 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; } /**