improved ipam

This commit is contained in:
2025-08-21 14:34:42 +02:00
parent 50d9769e94
commit c8fe1ca78c
3 changed files with 243 additions and 171 deletions

View File

@@ -96,7 +96,7 @@ class TTCrudBaseModel {
}
public static function get($id): TTCrudBaseModel {
public static function get($id) {
$db = self::getDB();
$id = $db->real_escape_string($id);
$table = self::getFullyQualifiedTable();
@@ -105,6 +105,8 @@ class TTCrudBaseModel {
$result = $db->query($sql);
// as TTCRudBaseModel is abstract, we need to get the class name of the child class
$class = get_called_class();
// return null if no result is found
if ($result->num_rows === 0) return null;
return new $class($result->fetch_assoc());
}