Refactor database object trait and improve data handling

Added `delete`, `restore`, and other utility methods to enhance CRUD operations, including support for soft deletes. Introduced `objectChanged` hooks across objects for better cache or event handling, ensuring scalability and maintainability. Refactored and standardized object property handling while restructuring related methods.
This commit is contained in:
Jepp9350
2025-02-12 09:23:35 +01:00
parent 555d4e9918
commit c240bbd94f
21 changed files with 343 additions and 92 deletions
@@ -20,7 +20,7 @@ class object_property
$this->required = $required;
$this->default = $default;
}
public function __toString(): string
{
// Return the value of the field in the database table
@@ -50,6 +50,7 @@ class object_property
// Set the value of the field in the database table
global /** @var db $db */
$db;
// If the value is null, set it to null
if ($value === null) {
$sql = "UPDATE $this->table SET $this->column = NULL WHERE id = $this->id";