From efa7ccc8fca05a799c68f7160b186b68ab9a6263 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 27 Mar 2026 02:37:41 +1300 Subject: [PATCH] (fix): alias Query\Method as QueryMethod to avoid SDK\Method collision --- app/controllers/api/projects.php | 4 ++-- app/controllers/general.php | 20 +++++++++---------- .../Collections/Attributes/XList.php | 4 ++-- .../Functions/Http/Executions/XList.php | 6 +++--- .../Modules/Sites/Http/Logs/XList.php | 6 +++--- .../Http/Installations/Repositories/XList.php | 6 +++--- .../Modules/VCS/Http/Installations/XList.php | 4 ++-- 7 files changed, 25 insertions(+), 25 deletions(-) diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index 3447e2ba5a..97560ef20d 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -31,7 +31,7 @@ use Utopia\Database\Validator\UID; use Utopia\Emails\Validator\Email; use Utopia\Http\Http; use Utopia\Locale\Locale; -use Utopia\Query\Method; +use Utopia\Query\Method as QueryMethod; use Utopia\System\System; use Utopia\Validator\ArrayList; use Utopia\Validator\Boolean; @@ -873,7 +873,7 @@ Http::get('/v1/projects/:projectId/keys') } // Backwards compatibility - if (\count(Query::getByType($queries, [Method::Limit])) === 0) { + if (\count(Query::getByType($queries, [QueryMethod::Limit])) === 0) { $queries[] = Query::limit(5000); } diff --git a/app/controllers/general.php b/app/controllers/general.php index 8b00cda6c0..8c95702ef9 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -56,7 +56,7 @@ use Utopia\Logger\Log; use Utopia\Logger\Log\User; use Utopia\Logger\Logger; use Utopia\Platform\Service; -use Utopia\Query\Method; +use Utopia\Query\Method as QueryMethod; use Utopia\Span\Span; use Utopia\System\System; use Utopia\Validator; @@ -1343,7 +1343,7 @@ Http::error() } // logical queries - recursively format nested queries - if (in_array($method, [Method::And, Method::Or], true)) { + if (in_array($method, [QueryMethod::And, QueryMethod::Or], true)) { $nested = []; foreach ($values as $nestedArray) { if (is_array($nestedArray)) { @@ -1357,26 +1357,26 @@ Http::error() } // select - show selected attributes - if ($method === Method::Select) { + if ($method === QueryMethod::Select) { $attributes = array_values(array_filter($values, 'is_string')); return [$method => $attributes]; } // pagination if (in_array($method, [ - Method::Limit, - Method::Offset, - Method::CursorAfter, - Method::CursorBefore + QueryMethod::Limit, + QueryMethod::Offset, + QueryMethod::CursorAfter, + QueryMethod::CursorBefore ], true)) { return [$method => []]; } // orders if (in_array($method, [ - Method::OrderDesc, - Method::OrderAsc, - Method::OrderRandom + QueryQueryMethod::OrderDesc, + QueryQueryMethod::OrderAsc, + QueryQueryMethod::OrderRandom ], true)) { return [$method => !empty($attribute) ? [$attribute] : []]; } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/XList.php index e45b0c1d7b..34b74b50c6 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/XList.php @@ -18,7 +18,7 @@ use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Query\Cursor; use Utopia\Database\Validator\UID; use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; -use Utopia\Query\Method; +use Utopia\Query\Method as QueryMethod; use Utopia\Query\Schema\ColumnType; use Utopia\Validator\Boolean; @@ -96,7 +96,7 @@ class XList extends Action $cursor = \array_filter( $queries, - fn ($query) => \in_array($query->getMethod(), [Method::CursorAfter, Method::CursorBefore]) + fn ($query) => \in_array($query->getMethod(), [QueryMethod::CursorAfter, QueryMethod::CursorBefore]) ); $cursor = \reset($cursor); diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Executions/XList.php b/src/Appwrite/Platform/Modules/Functions/Http/Executions/XList.php index cd32ca3315..3d07906b3c 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Executions/XList.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Executions/XList.php @@ -21,7 +21,7 @@ use Utopia\Database\Validator\Query\Cursor; use Utopia\Database\Validator\UID; use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; -use Utopia\Query\Method; +use Utopia\Query\Method as QueryMethod; use Utopia\Validator\Boolean; class XList extends Base @@ -120,7 +120,7 @@ class XList extends Base // Capture what statuses the caller explicitly requested, before we mutate the query. $requestedStatuses = []; foreach ($queries as $query) { - if ($query->getMethod() === Method::Equal && $query->getAttribute() === 'status') { + if ($query->getMethod() === QueryMethod::Equal && $query->getAttribute() === 'status') { $requestedStatuses = [...$requestedStatuses, ...$query->getValues()]; } } @@ -129,7 +129,7 @@ class XList extends Base // waiting/processing executions created before the timeout threshold, so timed-out // executions that were never marked failed in the DB are included in the results. foreach ($queries as $index => $query) { - if ($query->getMethod() === Method::Equal && $query->getAttribute() === 'status' && \in_array('failed', $query->getValues())) { + if ($query->getMethod() === QueryMethod::Equal && $query->getAttribute() === 'status' && \in_array('failed', $query->getValues())) { $queries[$index] = Query::or([ $query, Query::and([ diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Logs/XList.php b/src/Appwrite/Platform/Modules/Sites/Http/Logs/XList.php index 023cee1bb9..9acfe8bbed 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Logs/XList.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Logs/XList.php @@ -20,7 +20,7 @@ use Utopia\Database\Validator\Query\Cursor; use Utopia\Database\Validator\UID; use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; -use Utopia\Query\Method; +use Utopia\Query\Method as QueryMethod; use Utopia\Validator\Boolean; class XList extends Base @@ -109,7 +109,7 @@ class XList extends Base // Capture what statuses the caller explicitly requested, before we mutate the query. $requestedStatuses = []; foreach ($queries as $query) { - if ($query->getMethod() === Method::Equal && $query->getAttribute() === 'status') { + if ($query->getMethod() === QueryMethod::Equal && $query->getAttribute() === 'status') { $requestedStatuses = [...$requestedStatuses, ...$query->getValues()]; } } @@ -118,7 +118,7 @@ class XList extends Base // waiting/processing logs created before the timeout threshold, so timed-out // logs that were never marked failed in the DB are included in the results. foreach ($queries as $index => $query) { - if ($query->getMethod() === Method::Equal && $query->getAttribute() === 'status' && \in_array('failed', $query->getValues())) { + if ($query->getMethod() === QueryMethod::Equal && $query->getAttribute() === 'status' && \in_array('failed', $query->getValues())) { $queries[$index] = Query::or([ $query, Query::and([ diff --git a/src/Appwrite/Platform/Modules/VCS/Http/Installations/Repositories/XList.php b/src/Appwrite/Platform/Modules/VCS/Http/Installations/Repositories/XList.php index 582a94681a..05c8f994c3 100644 --- a/src/Appwrite/Platform/Modules/VCS/Http/Installations/Repositories/XList.php +++ b/src/Appwrite/Platform/Modules/VCS/Http/Installations/Repositories/XList.php @@ -51,7 +51,7 @@ use Utopia\Detector\Detector\Packager; use Utopia\Detector\Detector\Runtime; use Utopia\Detector\Detector\Strategy; use Utopia\Platform\Scope\HTTP; -use Utopia\Query\Method; +use Utopia\Query\Method as QueryMethod; use Utopia\System\System; use Utopia\Validator\Text; use Utopia\Validator\WhiteList; @@ -130,8 +130,8 @@ class XList extends Action $github->initializeVariables($providerInstallationId, $privateKey, $githubAppId); $queries = Query::parseQueries($queries); - $limitQuery = current(array_filter($queries, fn ($query) => $query->getMethod() === Method::Limit)); - $offsetQuery = current(array_filter($queries, fn ($query) => $query->getMethod() === Method::Offset)); + $limitQuery = current(array_filter($queries, fn ($query) => $query->getMethod() === QueryMethod::Limit)); + $offsetQuery = current(array_filter($queries, fn ($query) => $query->getMethod() === QueryMethod::Offset)); $limit = !empty($limitQuery) ? $limitQuery->getValue() : 4; $offset = !empty($offsetQuery) ? $offsetQuery->getValue() : 0; diff --git a/src/Appwrite/Platform/Modules/VCS/Http/Installations/XList.php b/src/Appwrite/Platform/Modules/VCS/Http/Installations/XList.php index 9c33c5bbb8..c4a29abcd0 100644 --- a/src/Appwrite/Platform/Modules/VCS/Http/Installations/XList.php +++ b/src/Appwrite/Platform/Modules/VCS/Http/Installations/XList.php @@ -16,7 +16,7 @@ use Utopia\Database\Exception\Query as QueryException; use Utopia\Database\Query; use Utopia\Database\Validator\Query\Cursor; use Utopia\Platform\Scope\HTTP; -use Utopia\Query\Method; +use Utopia\Query\Method as QueryMethod; use Utopia\Validator\Boolean; use Utopia\Validator\Text; @@ -84,7 +84,7 @@ class XList extends Action * Get cursor document if there was a cursor query, we use array_filter and reset for reference $cursor to $queries */ $cursor = \array_filter($queries, function ($query) { - return \in_array($query->getMethod(), [Method::CursorAfter, Method::CursorBefore]); + return \in_array($query->getMethod(), [QueryMethod::CursorAfter, QueryMethod::CursorBefore]); }); $cursor = reset($cursor); if ($cursor) {