Skip to content

Commit 84d3648

Browse files
committed
Composer update and bulk ids on errors
1 parent 9e82a24 commit 84d3648

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

composer.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,14 @@
8282
"@build",
8383
"@php vendor/bin/testbench serve"
8484
],
85-
"lint": [
86-
"@php vendor/bin/phpstan analyse"
87-
],
85+
"lint": "pint -v",
86+
"test:lint": "pint --test -v",
87+
"test:types": "phpstan analyse --ansi",
88+
"test:unit": "pest --colors=always",
8889
"test": [
89-
"@php vendor/bin/pest"
90+
"@test:lint",
91+
"@test:types",
92+
"@test:unit"
9093
]
9194
}
9295
}

src/DSL/Bridge.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,14 +400,17 @@ public function processInsertBulk(array $records, bool $returnData = false, stri
400400
$finalResponse['hasErrors'] = $response['errors'];
401401
$finalResponse['took'] = $response['took'];
402402
foreach ($response['items'] as $count => $hit) {
403+
403404
$finalResponse['total']++;
404405
$payload = $params['body'][($count * 2) + 1];
406+
$id = $hit['index']['_id'];
407+
$record = ['_id' => $id] + $payload;
405408

406409
if (! empty($hit['index']['error'])) {
407410
$finalResponse['failed']++;
408411
$finalResponse['error_bag'][] = [
409412
'error' => $hit['index']['error'],
410-
'payload' => $payload,
413+
'payload' => $record,
411414
];
412415
} else {
413416
$finalResponse['success']++;
@@ -419,8 +422,7 @@ public function processInsertBulk(array $records, bool $returnData = false, stri
419422
}
420423

421424
if ($returnData) {
422-
$id = $hit['index']['_id'];
423-
$record = ['_id' => $id] + $payload;
425+
424426
$finalResponse['data'][] = $record;
425427
}
426428
}

0 commit comments

Comments
 (0)