mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 00:49:02 +00:00
Ensure ID on create doc op
This commit is contained in:
parent
7861ee8cbd
commit
04a9ff9c23
1 changed files with 4 additions and 1 deletions
|
|
@ -88,7 +88,7 @@ class Update extends Action
|
|||
}
|
||||
|
||||
if ($commit) {
|
||||
$dbForProject->withTransaction(function () use ($dbForProject, $queueForDeletes, $transactionId, $transaction) {
|
||||
$dbForProject->withTransaction(function () use ($dbForProject, $queueForDeletes, $transactionId, &$transaction) {
|
||||
$dbForProject->updateDocument('transactions', $transactionId, new Document([
|
||||
'status' => 'committing',
|
||||
]));
|
||||
|
|
@ -113,6 +113,9 @@ class Update extends Action
|
|||
$dbForProject->withRequestTimestamp($createdAt, function () use ($dbForProject, $queueForDeletes, $action, $collectionId, $documentId, $data) {
|
||||
switch ($action) {
|
||||
case 'create':
|
||||
if ($documentId && !isset($data['$id'])) {
|
||||
$data['$id'] = $documentId;
|
||||
}
|
||||
$document = new Document($data);
|
||||
$dbForProject->createDocument($collectionId, $document);
|
||||
break;
|
||||
|
|
|
|||
Loading…
Reference in a new issue