Skip to content

Commit 1f92cd0

Browse files
committed
Fix name ref
1 parent 6360344 commit 1f92cd0

1 file changed

Lines changed: 19 additions & 19 deletions

File tree

src/Database/Database.php

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4179,17 +4179,17 @@ public function updateDocuments(
41794179
$new[] = Query::cursorAfter($last);
41804180
}
41814181

4182-
$affectedDocuments = $this->silent(fn () => $this->find(
4182+
$batch = $this->silent(fn () => $this->find(
41834183
$collection->getId(),
41844184
array_merge($new, $queries),
41854185
forPermission: Database::PERMISSION_UPDATE
41864186
));
41874187

4188-
if (empty($affectedDocuments)) {
4188+
if (empty($batch)) {
41894189
break;
41904190
}
41914191

4192-
foreach ($affectedDocuments as &$document) {
4192+
foreach ($batch as &$document) {
41934193
if ($this->resolveRelationships) {
41944194
$newDocument = new Document(array_merge($document->getArrayCopy(), $updates->getArrayCopy()));
41954195
$this->silent(fn () => $this->updateDocumentRelationships($collection, $document, $newDocument));
@@ -4208,38 +4208,38 @@ public function updateDocuments(
42084208
}
42094209
}
42104210

4211-
$this->withTransaction(function () use ($collection, $updates, $authorization, $skipAuth, $affectedDocuments) {
4211+
$this->withTransaction(function () use ($collection, $updates, $authorization, $skipAuth, $batch) {
42124212
$getResults = fn () => $this->adapter->updateDocuments(
42134213
$collection->getId(),
42144214
$updates,
4215-
$affectedDocuments
4215+
$batch
42164216
);
42174217

42184218
$skipAuth
42194219
? $authorization->skip($getResults)
42204220
: $getResults();
42214221
});
42224222

4223-
foreach ($affectedDocuments as $document) {
4223+
foreach ($batch as $doc) {
42244224
if ($this->getSharedTables() && $this->getTenantPerDocument()) {
4225-
$this->withTenant($document->getTenant(), function () use ($collection, $document) {
4226-
$this->purgeCachedDocument($collection->getId(), $document->getId());
4225+
$this->withTenant($doc->getTenant(), function () use ($collection, $doc) {
4226+
$this->purgeCachedDocument($collection->getId(), $doc->getId());
42274227
});
42284228
} else {
4229-
$this->purgeCachedDocument($collection->getId(), $document->getId());
4229+
$this->purgeCachedDocument($collection->getId(), $doc->getId());
42304230
}
42314231

4232-
$onNext && $onNext($document);
4232+
$onNext && $onNext($doc);
42334233
$modified++;
42344234
}
42354235

4236-
if (count($affectedDocuments) < $batchSize) {
4236+
if (count($batch) < $batchSize) {
42374237
break;
42384238
} elseif ($originalLimit && $modified == $originalLimit) {
42394239
break;
42404240
}
42414241

4242-
$last = \end($affectedDocuments);
4242+
$last = \end($batch);
42434243
}
42444244

42454245
$this->trigger(self::EVENT_DOCUMENTS_UPDATE, new Document([
@@ -5533,21 +5533,21 @@ public function deleteDocuments(
55335533
}
55345534

55355535
/**
5536-
* @var array<Document> $affectedDocuments
5536+
* @var array<Document> $batch
55375537
*/
5538-
$affectedDocuments = $this->silent(fn () => $this->find(
5538+
$batch = $this->silent(fn () => $this->find(
55395539
$collection->getId(),
55405540
array_merge($new, $queries),
55415541
forPermission: Database::PERMISSION_DELETE
55425542
));
55435543

5544-
if (empty($affectedDocuments)) {
5544+
if (empty($batch)) {
55455545
break;
55465546
}
55475547

55485548
$internalIds = [];
55495549
$permissionIds = [];
5550-
foreach ($affectedDocuments as $document) {
5550+
foreach ($batch as $document) {
55515551
$internalIds[] = $document->getInternalId();
55525552
if (!empty($document->getPermissions())) {
55535553
$permissionIds[] = $document->getId();
@@ -5584,7 +5584,7 @@ public function deleteDocuments(
55845584
: $getResults();
55855585
});
55865586

5587-
foreach ($affectedDocuments as $document) {
5587+
foreach ($batch as $document) {
55885588
if ($this->getSharedTables() && $this->getTenantPerDocument()) {
55895589
$this->withTenant($document->getTenant(), function () use ($collection, $document) {
55905590
$this->purgeCachedDocument($collection->getId(), $document->getId());
@@ -5597,13 +5597,13 @@ public function deleteDocuments(
55975597
$modified++;
55985598
}
55995599

5600-
if (count($affectedDocuments) < $batchSize) {
5600+
if (count($batch) < $batchSize) {
56015601
break;
56025602
} elseif ($originalLimit && $modified >= $originalLimit) {
56035603
break;
56045604
}
56055605

5606-
$last = \end($affectedDocuments);
5606+
$last = \end($batch);
56075607
}
56085608

56095609
$this->trigger(self::EVENT_DOCUMENTS_DELETE, new Document([

0 commit comments

Comments
 (0)