Skip to content

Commit 4d2397d

Browse files
committed
Fix cached ref
1 parent 26a3e91 commit 4d2397d

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

src/Database/Database.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3529,11 +3529,11 @@ public function createDocuments(
35293529
return $this->adapter->createDocuments($collection->getId(), $chunk);
35303530
});
35313531

3532-
foreach ($batch as $document) {
3532+
foreach ($batch as $doc) {
35333533
if ($this->resolveRelationships) {
3534-
$document = $this->silent(fn () => $this->populateDocumentRelationships($collection, $document));
3534+
$doc = $this->silent(fn () => $this->populateDocumentRelationships($collection, $doc));
35353535
}
3536-
$onNext && $onNext($document);
3536+
$onNext && $onNext($doc);
35373537
$modified++;
35383538
}
35393539
}
@@ -4795,20 +4795,20 @@ public function createOrUpdateDocumentsWithIncrease(
47954795
$chunk
47964796
)));
47974797

4798-
foreach ($batch as $document) {
4798+
foreach ($batch as $doc) {
47994799
if ($this->resolveRelationships) {
4800-
$document = $this->silent(fn () => $this->populateDocumentRelationships($collection, $document));
4800+
$doc = $this->silent(fn () => $this->populateDocumentRelationships($collection, $doc));
48014801
}
48024802

48034803
if ($this->getSharedTables() && $this->getTenantPerDocument()) {
4804-
$this->withTenant($document->getTenant(), function () use ($collection, $document) {
4805-
$this->purgeCachedDocument($collection->getId(), $document->getId());
4804+
$this->withTenant($doc->getTenant(), function () use ($collection, $doc) {
4805+
$this->purgeCachedDocument($collection->getId(), $doc->getId());
48064806
});
48074807
} else {
4808-
$this->purgeCachedDocument($collection->getId(), $document->getId());
4808+
$this->purgeCachedDocument($collection->getId(), $doc->getId());
48094809
}
48104810

4811-
$onNext && $onNext($document);
4811+
$onNext && $onNext($doc);
48124812
$modified++;
48134813
}
48144814
}

tests/e2e/Adapter/Base.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2336,7 +2336,7 @@ public function testCreateDocumentsWithDifferentAttributes(): void
23362336
$this->assertEquals(5, $results[0]->getAttribute('integer'));
23372337
$this->assertEquals('not_default', $results[0]->getAttribute('string_default'));
23382338
$this->assertEquals('text📝', $results[1]->getAttribute('string'));
2339-
$this->assertNull($results[1]->getAttribute('integer'));
2339+
$this->assertEquals(null, $results[1]->getAttribute('integer'));
23402340
$this->assertEquals('default', $results[1]->getAttribute('string_default'));
23412341

23422342
/**

0 commit comments

Comments
 (0)