diff --git a/app/config/errors.php b/app/config/errors.php index 36ad4cb896..9e742d3296 100644 --- a/app/config/errors.php +++ b/app/config/errors.php @@ -668,6 +668,11 @@ return [ 'description' => 'The attribute type is invalid.', 'code' => 400, ], + Exception::RELATIONSHIP_VALUE_INVALID => [ + 'name' => Exception::RELATIONSHIP_VALUE_INVALID, + 'description' => 'The relationship value is invalid.', + 'code' => 400, + ], /** Indexes */ Exception::INDEX_NOT_FOUND => [ diff --git a/app/controllers/general.php b/app/controllers/general.php index 1251974cd0..f93289a49b 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -695,6 +695,9 @@ App::error() case 'Utopia\Database\Exception\Authorization': $error = new AppwriteException(AppwriteException::USER_UNAUTHORIZED); break; + case 'Utopia\Database\Exception\Relationship': + $error = new AppwriteException(AppwriteException::RELATIONSHIP_VALUE_INVALID, $error->getMessage(), previous: $error); + break; } $code = $error->getCode(); diff --git a/composer.json b/composer.json index 753dde70ad..df004e6b44 100644 --- a/composer.json +++ b/composer.json @@ -44,13 +44,13 @@ "ext-sockets": "*", "appwrite/php-runtimes": "0.13.*", "appwrite/php-clamav": "2.0.*", - "utopia-php/abuse": "0.36.*", + "utopia-php/abuse": "0.37.*", "utopia-php/analytics": "0.10.*", - "utopia-php/audit": "0.38.*", + "utopia-php/audit": "0.39.*", "utopia-php/cache": "0.9.*", "utopia-php/cli": "0.15.*", "utopia-php/config": "0.2.*", - "utopia-php/database": "0.48.*", + "utopia-php/database": "0.49.*", "utopia-php/domains": "0.5.*", "utopia-php/dsn": "0.2.*", "utopia-php/framework": "0.33.*", diff --git a/composer.lock b/composer.lock index 91a124d407..e3d59af2cf 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d295a10bf0faff65cbc41dc040bbfd4c", + "content-hash": "28ecd4705def24ce61eee0f6676439d6", "packages": [ { "name": "adhocore/jwt", @@ -1264,23 +1264,23 @@ }, { "name": "utopia-php/abuse", - "version": "0.36.0", + "version": "0.37.0", "source": { "type": "git", "url": "https://github.com/utopia-php/abuse.git", - "reference": "d3d09b4fa0db75935110714ad4b2a87f3ace31ed" + "reference": "2de5c12886cbd516e511e559afdd9e615d871062" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/abuse/zipball/d3d09b4fa0db75935110714ad4b2a87f3ace31ed", - "reference": "d3d09b4fa0db75935110714ad4b2a87f3ace31ed", + "url": "https://api.github.com/repos/utopia-php/abuse/zipball/2de5c12886cbd516e511e559afdd9e615d871062", + "reference": "2de5c12886cbd516e511e559afdd9e615d871062", "shasum": "" }, "require": { "ext-curl": "*", "ext-pdo": "*", "php": ">=8.0", - "utopia-php/database": "0.48.*" + "utopia-php/database": "0.49.*" }, "require-dev": { "laravel/pint": "1.5.*", @@ -1307,9 +1307,9 @@ ], "support": { "issues": "https://github.com/utopia-php/abuse/issues", - "source": "https://github.com/utopia-php/abuse/tree/0.36.0" + "source": "https://github.com/utopia-php/abuse/tree/0.37.0" }, - "time": "2024-01-19T09:32:56+00:00" + "time": "2024-03-06T21:20:27+00:00" }, { "name": "utopia-php/analytics", @@ -1359,21 +1359,21 @@ }, { "name": "utopia-php/audit", - "version": "0.38.0", + "version": "0.39.0", "source": { "type": "git", "url": "https://github.com/utopia-php/audit.git", - "reference": "a9067f4af76e8787f1d29850a8ec94fc32bb6539" + "reference": "f0bc15012e05cc0b9dde012ab27d25f193768a2c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/audit/zipball/a9067f4af76e8787f1d29850a8ec94fc32bb6539", - "reference": "a9067f4af76e8787f1d29850a8ec94fc32bb6539", + "url": "https://api.github.com/repos/utopia-php/audit/zipball/f0bc15012e05cc0b9dde012ab27d25f193768a2c", + "reference": "f0bc15012e05cc0b9dde012ab27d25f193768a2c", "shasum": "" }, "require": { "php": ">=8.0", - "utopia-php/database": "0.48.*" + "utopia-php/database": "0.49.*" }, "require-dev": { "laravel/pint": "1.5.*", @@ -1400,9 +1400,9 @@ ], "support": { "issues": "https://github.com/utopia-php/audit/issues", - "source": "https://github.com/utopia-php/audit/tree/0.38.0" + "source": "https://github.com/utopia-php/audit/tree/0.39.0" }, - "time": "2024-01-19T09:33:05+00:00" + "time": "2024-03-06T21:20:37+00:00" }, { "name": "utopia-php/cache", @@ -1556,16 +1556,16 @@ }, { "name": "utopia-php/database", - "version": "0.48.4", + "version": "0.49.5", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "02f20bd901b8fab26d7dc2c58f7da1d6a08d21c0" + "reference": "6275ca8389d970bfd6096ab5d9c760ea000771cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/02f20bd901b8fab26d7dc2c58f7da1d6a08d21c0", - "reference": "02f20bd901b8fab26d7dc2c58f7da1d6a08d21c0", + "url": "https://api.github.com/repos/utopia-php/database/zipball/6275ca8389d970bfd6096ab5d9c760ea000771cf", + "reference": "6275ca8389d970bfd6096ab5d9c760ea000771cf", "shasum": "" }, "require": { @@ -1606,9 +1606,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/0.48.4" + "source": "https://github.com/utopia-php/database/tree/0.49.5" }, - "time": "2024-02-23T03:22:55+00:00" + "time": "2024-04-29T10:09:01+00:00" }, { "name": "utopia-php/domains", @@ -5529,5 +5529,5 @@ "platform-overrides": { "php": "8.3" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/src/Appwrite/Extend/Exception.php b/src/Appwrite/Extend/Exception.php index 1c5692cd9d..0ecb435dae 100644 --- a/src/Appwrite/Extend/Exception.php +++ b/src/Appwrite/Extend/Exception.php @@ -195,6 +195,9 @@ class Exception extends \Exception public const ATTRIBUTE_VALUE_INVALID = 'attribute_value_invalid'; public const ATTRIBUTE_TYPE_INVALID = 'attribute_type_invalid'; + /** Relationship */ + public const RELATIONSHIP_VALUE_INVALID = 'relationship_value_invalid'; + /** Indexes */ public const INDEX_NOT_FOUND = 'index_not_found'; public const INDEX_LIMIT_EXCEEDED = 'index_limit_exceeded';