Skip to content

Commit e43d1ba

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-63601' into troll_bugfix_kanban
2 parents 8becfa3 + e4b02a3 commit e43d1ba

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/internal/Magento/Framework/DB/Query/BatchRangeIterator.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class BatchRangeIterator implements BatchIteratorInterface
4646
/**
4747
* @var int
4848
*/
49-
private $currentBatch = 0;
49+
private $currentOffset = 0;
5050

5151
/**
5252
* @var int
@@ -107,7 +107,7 @@ public function __construct(
107107
public function current()
108108
{
109109
if (null === $this->currentSelect) {
110-
$this->isValid = ($this->currentBatch + $this->batchSize) < $this->totalItemCount;
110+
$this->isValid = ($this->currentOffset + $this->batchSize) < $this->totalItemCount;
111111
$this->currentSelect = $this->initSelectObject();
112112
}
113113
return $this->currentSelect;
@@ -138,7 +138,7 @@ public function next()
138138
if (null === $this->currentSelect) {
139139
$this->current();
140140
}
141-
$this->isValid = ($this->batchSize + $this->currentBatch) < $this->totalItemCount;
141+
$this->isValid = ($this->batchSize + $this->currentOffset) < $this->totalItemCount;
142142
$select = $this->initSelectObject();
143143
if ($this->isValid) {
144144
$this->iteration++;
@@ -201,8 +201,8 @@ private function initSelectObject()
201201
* Reset sort order section from origin select object
202202
*/
203203
$object->order($this->correlationName . '.' . $this->rangeField . ' ' . \Magento\Framework\DB\Select::SQL_ASC);
204-
$object->limit($this->currentBatch, $this->batchSize);
205-
$this->currentBatch += $this->batchSize;
204+
$object->limit($this->batchSize, $this->currentOffset);
205+
$this->currentOffset += $this->batchSize;
206206

207207
return $object;
208208
}

lib/internal/Magento/Framework/Test/Unit/DB/Query/BatchRangeIteratorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ protected function setUp()
9494
*/
9595
public function testCurrent()
9696
{
97-
$this->selectMock->expects($this->once())->method('limit')->with($this->currentBatch, $this->batchSize);
97+
$this->selectMock->expects($this->once())->method('limit')->with($this->batchSize, $this->currentBatch);
9898
$this->selectMock->expects($this->once())->method('order')->with('correlationName.rangeField' . ' ASC');
9999
$this->assertEquals($this->selectMock, $this->model->current());
100100
$this->assertEquals(0, $this->model->key());

0 commit comments

Comments
 (0)