Fix missing bulk map

This commit is contained in:
Jake Barnby 2025-10-02 21:37:54 +13:00
parent 26ae33522d
commit ae661e9961
No known key found for this signature in database
GPG key ID: C437A8CC85B96E9C

View file

@ -545,7 +545,7 @@ class Update extends Action
$dbForProject->withRequestTimestamp($createdAt, function () use ($dbForProject, $collectionId, $data, &$state) {
$dbForProject->createDocuments(
$collectionId,
$data,
\array_map(fn($doc) => new Document($doc), $data),
onNext: function (Document $document) use (&$state, $collectionId) {
$state[$collectionId][$document->getId()] = $document;
}
@ -603,7 +603,7 @@ class Update extends Action
// Run bulk upsert without timestamp wrapper, checking manually in callback
$dbForProject->upsertDocuments(
$collectionId,
$data,
\array_map(fn($doc) => new Document($doc), $data),
onNext: function (Document $upserted, ?Document $old) use (&$state, $collectionId, $createdAt) {
if ($old !== null) {
// This is an update - check if document was created/modified in this transaction