Skip to content
This repository was archived by the owner on Nov 4, 2021. It is now read-only.

Commit f6746d7

Browse files
committed
Fixed array keys for map method
1 parent 8ec4269 commit f6746d7

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/ElasticEngine.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ public function map($results, $model)
218218
if (isset($models[$id])) {
219219
return $models[$id];
220220
}
221-
})->filter();
221+
})->filter()->values();
222222
}
223223

224224
public function getTotalCount($results)

tests/ElasticEngineTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ public function testMap()
249249
];
250250

251251
$model = $this->mockModel([
252+
'key' => 2,
252253
'methods' => [
253254
'whereIn',
254255
'get',
@@ -267,7 +268,7 @@ public function testMap()
267268
$model
268269
->method('keyBy')
269270
->willReturn([
270-
1 => $model
271+
2 => $model
271272
]);
272273

273274
$this->assertEquals(

0 commit comments

Comments
 (0)