From dfeaec0f7bfd40e13387efe97229317f8aeea43f Mon Sep 17 00:00:00 2001 From: fogelito Date: Thu, 28 Mar 2024 11:22:12 +0200 Subject: [PATCH] transactions fix --- composer.json | 4 +- composer.lock | 107 ++++++++++++++++-------------- docker-compose.yml | 1 + src/Appwrite/Extend/Exception.php | 6 ++ 4 files changed, 66 insertions(+), 52 deletions(-) diff --git a/composer.json b/composer.json index d2984b580..0b232498d 100644 --- a/composer.json +++ b/composer.json @@ -50,7 +50,7 @@ "utopia-php/cache": "0.9.*", "utopia-php/cli": "0.15.*", "utopia-php/config": "0.2.*", - "utopia-php/database": "0.48.*", + "utopia-php/database": "dev-fix-transaction-rollback as 0.48.4", "utopia-php/domains": "0.5.*", "utopia-php/dsn": "0.2.*", "utopia-php/framework": "0.33.*", @@ -81,7 +81,7 @@ "ext-fileinfo": "*", "appwrite/sdk-generator": "0.37.*", "phpunit/phpunit": "9.5.20", - "swoole/ide-helper": "5.0.2", + "swoole/ide-helper": "5.1.2", "textalk/websocket": "1.5.7", "utopia-php/fetch": "0.1.*", "laravel/pint": "^1.14" diff --git a/composer.lock b/composer.lock index c5787c3fe..7ab848dbc 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": "a172283bd36fcb6b8d421db5d3a66a6e", + "content-hash": "49031a76379fcc7b24b3ed4f9cd43029", "packages": [ { "name": "adhocore/jwt", @@ -1556,16 +1556,16 @@ }, { "name": "utopia-php/database", - "version": "0.48.4", + "version": "dev-fix-transaction-rollback", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "02f20bd901b8fab26d7dc2c58f7da1d6a08d21c0" + "reference": "c3b76a5dd864791744168dcc6fb32eb159a08691" }, "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/c3b76a5dd864791744168dcc6fb32eb159a08691", + "reference": "c3b76a5dd864791744168dcc6fb32eb159a08691", "shasum": "" }, "require": { @@ -1573,6 +1573,7 @@ "ext-pdo": "*", "php": ">=8.0", "utopia-php/cache": "0.9.*", + "utopia-php/fetch": "0.1.*", "utopia-php/framework": "0.33.*", "utopia-php/mongo": "0.3.*" }, @@ -1606,9 +1607,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/fix-transaction-rollback" }, - "time": "2024-02-23T03:22:55+00:00" + "time": "2024-03-28T09:11:01+00:00" }, { "name": "utopia-php/domains", @@ -1717,6 +1718,45 @@ }, "time": "2023-11-02T12:01:43+00:00" }, + { + "name": "utopia-php/fetch", + "version": "0.1.0", + "source": { + "type": "git", + "url": "https://github.com/utopia-php/fetch.git", + "reference": "2fa214b9262acd1a3583515a364da4f35929d5c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/utopia-php/fetch/zipball/2fa214b9262acd1a3583515a364da4f35929d5c5", + "reference": "2fa214b9262acd1a3583515a364da4f35929d5c5", + "shasum": "" + }, + "require": { + "php": ">=8.0" + }, + "require-dev": { + "laravel/pint": "^1.5.0", + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^9.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Utopia\\Fetch\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A simple library that provides an interface for making HTTP Requests.", + "support": { + "issues": "https://github.com/utopia-php/fetch/issues", + "source": "https://github.com/utopia-php/fetch/tree/0.1.0" + }, + "time": "2023-10-10T11:58:32+00:00" + }, { "name": "utopia-php/framework", "version": "0.33.6", @@ -5043,7 +5083,7 @@ }, { "name": "swoole/ide-helper", - "version": "dev-master", + "version": "5.1.2", "source": { "type": "git", "url": "https://github.com/swoole/ide-helper.git", @@ -5055,7 +5095,6 @@ "reference": "33ec7af9111b76d06a70dd31191cc74793551112", "shasum": "" }, - "default-branch": true, "type": "library", "notification-url": "https://packagist.org/downloads/", "license": [ @@ -5403,51 +5442,19 @@ } ], "time": "2023-11-21T18:54:41+00:00" - }, - { - "name": "utopia-php/fetch", - "version": "0.1.0", - "source": { - "type": "git", - "url": "https://github.com/utopia-php/fetch.git", - "reference": "2fa214b9262acd1a3583515a364da4f35929d5c5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/utopia-php/fetch/zipball/2fa214b9262acd1a3583515a364da4f35929d5c5", - "reference": "2fa214b9262acd1a3583515a364da4f35929d5c5", - "shasum": "" - }, - "require": { - "php": ">=8.0" - }, - "require-dev": { - "laravel/pint": "^1.5.0", - "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^9.5" - }, - "type": "library", - "autoload": { - "psr-4": { - "Utopia\\Fetch\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "A simple library that provides an interface for making HTTP Requests.", - "support": { - "issues": "https://github.com/utopia-php/fetch/issues", - "source": "https://github.com/utopia-php/fetch/tree/0.1.0" - }, - "time": "2023-10-10T11:58:32+00:00" } ], - "aliases": [], + "aliases": [ + { + "package": "utopia-php/database", + "version": "dev-fix-transaction-rollback", + "alias": "0.48.4", + "alias_normalized": "0.48.4.0" + } + ], "minimum-stability": "stable", "stability-flags": { - "swoole/ide-helper": 20 + "utopia-php/database": 20 }, "prefer-stable": false, "prefer-lowest": false, diff --git a/docker-compose.yml b/docker-compose.yml index 58dff5690..27f34c854 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -84,6 +84,7 @@ services: - ./public:/usr/src/code/public - ./src:/usr/src/code/src - ./dev:/usr/src/code/dev + - ./vendor/utopia-php/database:/usr/src/code/vendor/utopia-php/database depends_on: - mariadb - redis diff --git a/src/Appwrite/Extend/Exception.php b/src/Appwrite/Extend/Exception.php index 510c64014..3b26fbac4 100644 --- a/src/Appwrite/Extend/Exception.php +++ b/src/Appwrite/Extend/Exception.php @@ -301,6 +301,12 @@ class Exception extends \Exception $this->errors = Config::getParam('errors'); $this->type = $type; $this->code = $code ?? $this->errors[$type]['code']; + + // shmuel + if(is_string($this->code)){ + $this->code = 500; + } + $this->message = $message ?? $this->errors[$type]['description']; $this->publish = $this->errors[$type]['publish'] ?? ($this->code >= 500);