Merge pull request #11398 from appwrite/fix-cast

This commit is contained in:
Jake Barnby
2026-02-25 09:58:35 +00:00
committed by GitHub
9 changed files with 63 additions and 30 deletions
Generated
+21 -22
View File
@@ -3403,16 +3403,16 @@
},
{
"name": "utopia-php/agents",
"version": "1.2.0",
"version": "1.2.1",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/agents.git",
"reference": "9291c4616b794bd3f0a342bfabaad2c2a4de7a19"
"reference": "052227953678a30ecc4b5467401fcb0b2386471e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/agents/zipball/9291c4616b794bd3f0a342bfabaad2c2a4de7a19",
"reference": "9291c4616b794bd3f0a342bfabaad2c2a4de7a19",
"url": "https://api.github.com/repos/utopia-php/agents/zipball/052227953678a30ecc4b5467401fcb0b2386471e",
"reference": "052227953678a30ecc4b5467401fcb0b2386471e",
"shasum": ""
},
"require": {
@@ -3420,10 +3420,9 @@
"utopia-php/fetch": "0.5.*"
},
"require-dev": {
"laravel/pint": "1.2.*",
"phpstan/phpstan": "1.9.x-dev",
"phpunit/phpunit": "^9.3",
"vimeo/psalm": "4.0.1"
"laravel/pint": "^1.18",
"phpstan/phpstan": "^2.0",
"phpunit/phpunit": "^12.0"
},
"type": "library",
"autoload": {
@@ -3451,9 +3450,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/agents/issues",
"source": "https://github.com/utopia-php/agents/tree/1.2.0"
"source": "https://github.com/utopia-php/agents/tree/1.2.1"
},
"time": "2026-02-23T12:08:31+00:00"
"time": "2026-02-24T06:03:55+00:00"
},
{
"name": "utopia-php/analytics",
@@ -4059,16 +4058,16 @@
},
{
"name": "utopia-php/domains",
"version": "1.0.1",
"version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/domains.git",
"reference": "20b6a6868234d766fef35a47814dccc66906c2af"
"reference": "b4896a6746f0fbe29dfd5e32f7790bd94c1af1e6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/domains/zipball/20b6a6868234d766fef35a47814dccc66906c2af",
"reference": "20b6a6868234d766fef35a47814dccc66906c2af",
"url": "https://api.github.com/repos/utopia-php/domains/zipball/b4896a6746f0fbe29dfd5e32f7790bd94c1af1e6",
"reference": "b4896a6746f0fbe29dfd5e32f7790bd94c1af1e6",
"shasum": ""
},
"require": {
@@ -4115,9 +4114,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/domains/issues",
"source": "https://github.com/utopia-php/domains/tree/1.0.1"
"source": "https://github.com/utopia-php/domains/tree/1.0.2"
},
"time": "2026-02-06T12:45:12+00:00"
"time": "2026-02-25T08:18:25+00:00"
},
{
"name": "utopia-php/dsn",
@@ -5439,16 +5438,16 @@
"packages-dev": [
{
"name": "appwrite/sdk-generator",
"version": "1.10.2",
"version": "1.11.1",
"source": {
"type": "git",
"url": "https://github.com/appwrite/sdk-generator.git",
"reference": "b31e6b4209ecad46d2fef509dc59f1945d0e83cb"
"reference": "6ff411f26f2750eea05c7598c14bb3a2ada898cb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/b31e6b4209ecad46d2fef509dc59f1945d0e83cb",
"reference": "b31e6b4209ecad46d2fef509dc59f1945d0e83cb",
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/6ff411f26f2750eea05c7598c14bb3a2ada898cb",
"reference": "6ff411f26f2750eea05c7598c14bb3a2ada898cb",
"shasum": ""
},
"require": {
@@ -5484,9 +5483,9 @@
"description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms",
"support": {
"issues": "https://github.com/appwrite/sdk-generator/issues",
"source": "https://github.com/appwrite/sdk-generator/tree/1.10.2"
"source": "https://github.com/appwrite/sdk-generator/tree/1.11.1"
},
"time": "2026-02-23T04:04:15+00:00"
"time": "2026-02-25T07:15:19+00:00"
},
{
"name": "brianium/paratest",
@@ -102,6 +102,7 @@ class Get extends Action
'supportForAttributeResizing' => $adapter->getSupportForAttributeResizing(),
'supportForSchemas' => $adapter->getSupportForSchemas(),
'maxIndexLength' => $adapter->getMaxIndexLength(),
'supportForIntegerIds' => $adapter->getIdAttributeType() === 'integer',
]);
$response->dynamic($variables, Response::MODEL_CONSOLE_VARIABLES);
@@ -839,10 +839,14 @@ class OpenAPI3 extends Format
case 'string':
case 'datetime':
case 'payload':
case 'id':
$type = 'string';
break;
case 'id':
$type = 'integer';
$format = $rule['format'] ?? 'int32';
break;
case 'enum':
$type = 'string';
break;
@@ -819,10 +819,14 @@ class Swagger2 extends Format
switch ($rule['type']) {
case 'string':
case 'datetime':
case 'id':
$type = 'string';
break;
case 'id':
$type = 'integer';
$format = $rule['format'] ?? 'int32';
break;
case 'enum':
$type = 'string';
break;
@@ -196,6 +196,15 @@ class ConsoleVariables extends Model
'example' => 768,
]
)
->addRule(
'supportForIntegerIds',
[
'type' => self::TYPE_BOOLEAN,
'description' => 'Whether the database adapter uses integer sequence IDs.',
'default' => true,
'example' => true,
]
)
;
}
@@ -83,9 +83,8 @@ class Document extends Any
$document->removeAttribute('$collection');
$document->removeAttribute('$tenant');
if (!$document->isEmpty()) {
$sequence = $document->getAttribute('$sequence', '');
$document->setAttribute('$sequence', $sequence);
if (!$document->isEmpty() && \is_numeric($document->getAttribute('$sequence', 0))) {
$document->setAttribute('$sequence', (int)$document->getAttribute('$sequence', 0));
}
foreach ($document->getAttributes() as $attribute) {
+4 -2
View File
@@ -82,8 +82,10 @@ class Row extends Any
{
$document->removeAttribute('$collection');
$document->removeAttribute('$tenant');
$sequence = $document->getAttribute('$sequence', '');
$document->setAttribute('$sequence', $sequence);
if (!$document->isEmpty() && \is_numeric($document->getAttribute('$sequence', 0))) {
$document->setAttribute('$sequence', (int)$document->getAttribute('$sequence', 0));
}
foreach ($document->getAttributes() as $column) {
if (\is_array($column)) {
+8
View File
@@ -143,6 +143,14 @@ abstract class Scope extends TestCase
return $this->getConsoleVariables()['maxIndexLength'] ?? 768;
}
/**
* Check if the database adapter uses integer sequence IDs
*/
protected function getSupportForIntegerIds(): bool
{
return $this->getConsoleVariables()['supportForIntegerIds'] ?? true;
}
protected function getLastEmail(int $limit = 1, ?callable $probe = null): array
{
$result = [];
@@ -2567,6 +2567,10 @@ trait DatabasesBase
$this->assertEquals($document1['body']['birthDay'], '1975-06-12T12:12:55.000+00:00');
$this->assertTrue(array_key_exists('$sequence', $document1['body']));
$this->getSupportForIntegerIds()
? $this->assertIsInt($document1['body']['$sequence'])
: $this->assertIsString($document1['body']['$sequence']);
$this->assertEquals(201, $document2['headers']['status-code']);
$this->assertEquals($data['moviesId'], $document2['body'][$this->getContainerIdResponseKey()]);
$this->assertArrayNotHasKey('$collection', $document2['body']);
@@ -2637,7 +2641,10 @@ trait DatabasesBase
/**
* Resubmit same document, nothing to update
*/
$this->assertIsString($document['body']['$sequence']);
$this->getSupportForIntegerIds()
? $this->assertIsInt($document['body']['$sequence'])
: $this->assertIsString($document['body']['$sequence']);
$upsertData = [
'title' => 'Thor: Ragnarok',
'releaseYear' => 2000,