Skip to content

Commit c782477

Browse files
committed
Keep $id
1 parent 5038944 commit c782477

1 file changed

Lines changed: 1 addition & 10 deletions

File tree

src/Database/Database.php

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4900,20 +4900,11 @@ private function applySelectFiltersToDocuments(array $documents, array $selectQu
49004900
return;
49014901
}
49024902

4903-
// Always preserve internal attributes (use hashmap for O(1) lookup)
4904-
$internalKeys = \array_map(fn ($attr) => $attr['$id'], $this->getInternalAttributes());
4905-
foreach ($internalKeys as $key) {
4906-
//$attributesToKeep[$key] = true;
4907-
}
4903+
$attributesToKeep['$id'] = true; // Always return $id to be consistent with other relationship
49084904

49094905
foreach ($documents as $doc) {
49104906
$allKeys = \array_keys($doc->getArrayCopy());
49114907
foreach ($allKeys as $attrKey) {
4912-
// Keep if: explicitly selected OR is internal attribute ($ prefix)
4913-
// if (!isset($attributesToKeep[$attrKey]) && !\str_starts_with($attrKey, '$')) {
4914-
// $doc->removeAttribute($attrKey);
4915-
// }
4916-
49174908
if (!isset($attributesToKeep[$attrKey])) {
49184909
$doc->removeAttribute($attrKey);
49194910
}

0 commit comments

Comments
 (0)