From c95116f2c9e7fc928719fc2b289b2c23de96c8a7 Mon Sep 17 00:00:00 2001 From: Jeppe Bundgaard Date: Wed, 27 Aug 2025 08:40:24 +0200 Subject: [PATCH] Add float type support and SQL handling for float values in object properties - Included `float` as a valid type in type validation. - Added SQL update logic for handling float values in object properties. --- services/nginx/app/classes/object_property.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/services/nginx/app/classes/object_property.php b/services/nginx/app/classes/object_property.php index 33325dfe..5882e976 100644 --- a/services/nginx/app/classes/object_property.php +++ b/services/nginx/app/classes/object_property.php @@ -51,7 +51,7 @@ class object_property throw new \InvalidArgumentException("Table or column cannot be empty"); } // Check if the type is valid - if (!in_array($this->type, ['int', 'varchar', 'text', 'date', 'datetime', 'string', 'timestamp', 'boolean', 'bool'])) { + if (!in_array($this->type, ['int', 'varchar', 'text', 'date', 'datetime', 'string', 'timestamp', 'boolean', 'bool', 'float'])) { throw new \InvalidArgumentException("Invalid type: $this->type"); } $sql = "SELECT $this->column FROM $this->table WHERE id = $this->id"; @@ -84,6 +84,9 @@ class object_property } // If the value is an integer, set it to the integer value elseif (is_int($value)) { $sql = "UPDATE $this->table SET $this->column = $value WHERE id = $this->id"; + } // If the value is a float, set it to the float value + elseif (is_float($value)) { + $sql = "UPDATE $this->table SET $this->column = $value WHERE id = $this->id"; } // If the value is a string, escape it else { $value = $db->escape_string($value);