(fix): fix Metadata relatedCollection lookup, aggregate test aliases, and decorator silencing

- Metadata decorator: look for relatedCollection inside options array
  since new Attribute format nests it there
- Skip decorators during silenced operations to prevent $databaseId etc.
  from leaking into internal write operations
- Fix aggregate test queries to use Query::count('*', 'total') instead
  of Query::count('total') which treats 'total' as a column name

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jake BarnbyandClaude Opus 4.6 committed 2026-04-01 00:56:19 +13:00
1 parent 7fc153d344
commit 1b1b1dfc2b
3 files changed
+12 -10

No files matched your search

Generated
+3 -3
View File
@@ -4038,12 +4038,12 @@
"source": {
"type": "git",
"url": "https://github.com/utopia-php/database.git",
"reference": "93b7f4d01a2b7794374d53b7d5cf8e4b9d2509fe"
"reference": "84c0c749113178947a07bd047569dbe7f67f2906"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/database/zipball/93b7f4d01a2b7794374d53b7d5cf8e4b9d2509fe",
"reference": "93b7f4d01a2b7794374d53b7d5cf8e4b9d2509fe",
"url": "https://api.github.com/repos/utopia-php/database/zipball/84c0c749113178947a07bd047569dbe7f67f2906",
"reference": "84c0c749113178947a07bd047569dbe7f67f2906",
"shasum": ""
},
"require": {
@@ -84,7 +84,9 @@ class Metadata implements Decorator
}
$relations = \is_array($related) ? $related : [$related];
$relatedCollectionId = $relationship->getAttribute('relatedCollection');
$options = $relationship->getAttribute('options', []);
$relatedCollectionId = (\is_array($options) ? ($options['relatedCollection'] ?? null) : null)
?? $relationship->getAttribute('relatedCollection');
foreach ($relations as $relation) {
if ($relation instanceof Document) {
@@ -11402,7 +11402,7 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::count('total')->toString(),
Query::count('*', 'total')->toString(),
],
]);
@@ -11479,7 +11479,7 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::count('total')->toString(),
Query::count('*', 'total')->toString(),
Query::groupBy(['title'])->toString(),
],
]);
@@ -11505,7 +11505,7 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::count('total')->toString(),
Query::count('*', 'total')->toString(),
Query::groupBy(['releaseYear'])->toString(),
Query::having([Query::greaterThanEqual('total', 1)])->toString(),
],
@@ -11601,7 +11601,7 @@ trait DatabasesBase
'x-appwrite-key' => $this->getProject()['apiKey'],
]), [
'queries' => [
Query::count('total')->toString(),
Query::count('*', 'total')->toString(),
Query::join($libraryId, 'libraries', '$id')->toString(),
Query::groupBy(['fullName'])->toString(),
],
@@ -11648,7 +11648,7 @@ trait DatabasesBase
], $this->getHeaders()), [
'queries' => [
Query::greaterThan('releaseYear', 2000)->toString(),
Query::count('total')->toString(),
Query::count('*', 'total')->toString(),
],
]);
@@ -11874,7 +11874,7 @@ trait DatabasesBase
], [
'queries' => [
Query::join($libraryId, 'library', '$id')->toString(),
Query::count('total')->toString(),
Query::count('*', 'total')->toString(),
],
]);