Skip to content

Commit 15fdb4d

Browse files
author
Bizley
authored
Fix #327: Fix yii\mongodb\BatchQueryResult to be compatible with PECL MongoDb 1.9.0 driver
1 parent 51c6292 commit 15fdb4d

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ env:
77

88
jobs:
99
phpunit:
10-
name: PHP ${{ matrix.php }} on ${{ matrix.os }}
10+
name: PHP ${{ matrix.php }} (mongodb ${{ matrix.mongoext }}) on ${{ matrix.os }}
1111
runs-on: ${{ matrix.os }}
1212
services:
1313
mongodb:
@@ -20,6 +20,7 @@ jobs:
2020
os: [ubuntu-latest]
2121
php: ['7.0', '7.1', '7.2', '7.3', '7.4']
2222
mongo: ['3']
23+
mongoext: ['1.8.2', '1.9.0']
2324

2425
steps:
2526
- name: Checkout
@@ -29,7 +30,7 @@ jobs:
2930
with:
3031
php-version: ${{ matrix.php }}
3132
tools: pecl
32-
extensions: mongodb
33+
extensions: mongodb-${{ matrix.mongoext }}
3334
ini-values: date.timezone='UTC'
3435
- name: Get composer cache directory
3536
id: composer-cache

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Yii Framework 2 mongodb extension Change Log
44
2.1.11 under development
55
------------------------
66

7-
- no changes in this release.
7+
- Bug #327: Fix `yii\mongodb\BatchQueryResult` to be compatible with PECL MongoDb 1.9.0 driver (bizley)
88

99

1010
2.1.10 November 10, 2020

src/BatchQueryResult.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,11 @@ protected function fetchData()
146146
$count = 0;
147147

148148
while ($count++ < $this->batchSize) {
149-
$row = $this->_iterator->current();
150-
if ($row === null) {
149+
if (!$this->_iterator->valid()) {
151150
break;
152151
}
152+
$rows[] = $this->_iterator->current();
153153
$this->_iterator->next();
154-
//var_dump($row);
155-
$rows[] = $row;
156154
}
157155
return $this->query->populate($rows);
158156
}
@@ -186,4 +184,4 @@ public function valid()
186184
{
187185
return !empty($this->_batch);
188186
}
189-
}
187+
}

0 commit comments

Comments
 (0)