From 5101db4172ed59adad75493e8938b18f06cf79dd Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 27 Mar 2026 01:13:10 +1300 Subject: [PATCH] (fix): pass ColumnType string values to Structure::addFormat and hasFormat --- app/init/database/formats.php | 14 +++++++------- .../Databases/Collections/Attributes/Action.php | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/init/database/formats.php b/app/init/database/formats.php index 790dcc0224..845c296b8f 100644 --- a/app/init/database/formats.php +++ b/app/init/database/formats.php @@ -11,33 +11,33 @@ use Utopia\Validator\WhiteList; Structure::addFormat(APP_DATABASE_ATTRIBUTE_EMAIL, function () { return new Email(); -}, ColumnType::String); +}, ColumnType::String->value); Structure::addFormat(APP_DATABASE_ATTRIBUTE_DATETIME, function () { return new DatetimeValidator(); -}, ColumnType::Datetime); +}, ColumnType::Datetime->value); Structure::addFormat(APP_DATABASE_ATTRIBUTE_ENUM, function ($attribute) { $elements = $attribute['formatOptions']['elements'] ?? []; return new WhiteList($elements, true); -}, ColumnType::String); +}, ColumnType::String->value); Structure::addFormat(APP_DATABASE_ATTRIBUTE_IP, function () { return new IP(); -}, ColumnType::String); +}, ColumnType::String->value); Structure::addFormat(APP_DATABASE_ATTRIBUTE_URL, function () { return new URL(); -}, ColumnType::String); +}, ColumnType::String->value); Structure::addFormat(APP_DATABASE_ATTRIBUTE_INT_RANGE, function ($attribute) { $min = $attribute['formatOptions']['min'] ?? -INF; $max = $attribute['formatOptions']['max'] ?? INF; return new Range($min, $max, Range::TYPE_INTEGER); -}, ColumnType::Integer); +}, ColumnType::Integer->value); Structure::addFormat(APP_DATABASE_ATTRIBUTE_FLOAT_RANGE, function ($attribute) { $min = $attribute['formatOptions']['min'] ?? -INF; $max = $attribute['formatOptions']['max'] ?? INF; return new Range($min, $max, Range::TYPE_FLOAT); -}, ColumnType::Float); +}, ColumnType::Float->value); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Action.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Action.php index d3339b7d43..f8a760c219 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Action.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Action.php @@ -343,7 +343,7 @@ abstract class Action extends UtopiaAction } if (!empty($format)) { - if (!Structure::hasFormat($format, ColumnType::from($type))) { + if (!Structure::hasFormat($format, $type)) { throw new Exception($this->getFormatUnsupportedException(), "Format $format not available for $type columns."); } }