Skip to content

Commit 48220ca

Browse files
Update src/Database/Database.php
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 0c6e693 commit 48220ca

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Database/Database.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5087,11 +5087,15 @@ public function upsertDocument(
50875087
$collection,
50885088
'',
50895089
[$document],
5090-
function (Document $doc) use (&$result) {
5090+
function (Document $doc, ?Document $_old = null) use (&$result) {
50915091
$result = $doc;
50925092
}
50935093
);
50945094

5095+
if ($result === null) {
5096+
// No-op (unchanged): return the current persisted doc
5097+
$result = $this->getDocument($collection, $document->getId());
5098+
}
50955099
return $result;
50965100
}
50975101

0 commit comments

Comments
 (0)