Skip to content

Commit 7fea0b3

Browse files
committed
Remove internal attributes not queried
1 parent fd05e50 commit 7fea0b3

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/Database/Database.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3101,10 +3101,8 @@ public function getDocument(string $collection, string $id, array $queries = [],
31013101
$selectedAttributes = array_map(fn($q) => $q->getAttribute(), $selects);
31023102

31033103
foreach ($this->getInternalAttributes() as $internalAttribute) {
3104-
$attributeId = $internalAttribute['$id'];
3105-
3106-
if (!in_array($attributeId, $selectedAttributes, true)) {
3107-
$document->removeAttribute($attributeId);
3104+
if (!in_array($internalAttribute['$id'], $selectedAttributes, true)) {
3105+
$document->removeAttribute($internalAttribute['$id']);
31083106
}
31093107
}
31103108
}

tests/e2e/Adapter/Base.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3148,7 +3148,7 @@ public function testGetDocumentSelect(Document $document): Document
31483148
Query::select('string'),
31493149
Query::select('integer_signed'),
31503150
]);
3151-
3151+
var_dump($document);
31523152
$this->assertEmpty($document->getId());
31533153
$this->assertFalse($document->isEmpty());
31543154
$this->assertIsString($document->getAttribute('string'));

0 commit comments

Comments
 (0)