Update src/Appwrite/Databases/TransactionState.php

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
Jake Barnby 2025-10-02 23:03:52 +13:00 committed by GitHub
parent 473be9284d
commit 93d8f1cfe7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -49,15 +49,15 @@ class TransactionState
switch ($action) {
case 'create':
if ($documentId) {
$state[$collectionId][$documentId] = [
$docId = $documentId ?? ($data['$id'] ?? null);
if ($docId) {
$state[$collectionId][$docId] = [
'action' => 'create',
'document' => new Document($data),
'exists' => true
];
}
break;
case 'update':
if (isset($state[$collectionId][$documentId])) {
// Update existing document in transaction state