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:
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user