Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions src/Database/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -3097,20 +3097,6 @@ public function getDocument(string $collection, string $id, array $queries = [],
}
}

// Remove internal attributes if not queried for select query
// $id, $permissions and $collection are the default selected attributes for (MariaDB, MySQL, SQLite, Postgres)
// All internal attributes are default selected attributes for (MongoDB)
foreach ($queries as $query) {
if ($query->getMethod() === Query::TYPE_SELECT) {
$values = $query->getValues();
foreach ($this->getInternalAttributes() as $internalAttribute) {
if (!\in_array($internalAttribute['$id'], $values)) {
$document->removeAttribute($internalAttribute['$id']);
}
}
}
}

$this->trigger(self::EVENT_DOCUMENT_READ, $document);

return $document;
Expand Down Expand Up @@ -5806,20 +5792,6 @@ public function find(string $collection, array $queries = [], string $forPermiss

unset($query);

// Remove internal attributes which are not queried
foreach ($queries as $query) {
if ($query->getMethod() === Query::TYPE_SELECT) {
$values = $query->getValues();
foreach ($results as $result) {
foreach ($this->getInternalAttributes() as $internalAttribute) {
if (!\in_array($internalAttribute['$id'], $values)) {
$result->removeAttribute($internalAttribute['$id']);
}
}
}
}
}

$this->trigger(self::EVENT_DOCUMENT_FIND, $results);

return $results;
Expand Down
Loading
Loading