diff --git a/app/init/database/formats.php b/app/init/database/formats.php index 845c296b8f..790dcc0224 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->value); +}, ColumnType::String); Structure::addFormat(APP_DATABASE_ATTRIBUTE_DATETIME, function () { return new DatetimeValidator(); -}, ColumnType::Datetime->value); +}, ColumnType::Datetime); Structure::addFormat(APP_DATABASE_ATTRIBUTE_ENUM, function ($attribute) { $elements = $attribute['formatOptions']['elements'] ?? []; return new WhiteList($elements, true); -}, ColumnType::String->value); +}, ColumnType::String); Structure::addFormat(APP_DATABASE_ATTRIBUTE_IP, function () { return new IP(); -}, ColumnType::String->value); +}, ColumnType::String); Structure::addFormat(APP_DATABASE_ATTRIBUTE_URL, function () { return new URL(); -}, ColumnType::String->value); +}, ColumnType::String); 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->value); +}, ColumnType::Integer); 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->value); +}, ColumnType::Float); 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 f8a760c219..d3339b7d43 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, $type)) { + if (!Structure::hasFormat($format, ColumnType::from($type))) { throw new Exception($this->getFormatUnsupportedException(), "Format $format not available for $type columns."); } }