Summary Files Commits Branches @commit @diff @stats
path: root / src / models / DBModel.php
diff options
context:
space:
mode:
1 files changed, 21 insertions, 0 deletions
-rw-r--r--src/models/DBModel.php21
diff --git a/src/models/DBModel.php b/src/models/DBModel.php
new file mode 100644
index 0000000..4e10c18
--- /dev/null
+++ b/src/models/DBModel.php
@@ -0,0 +1,21 @@
+<?php
+include_once("DB.php");
+
+/**
+ * A class, mainly for holding the static DB class intance. You can also get your model id from here.
+ */
+abstract class DBModel {
+ /**
+ * Used ONLY for gotten values form the database. Must not be assigned to, since it is AUTO_INCREMENT.
+ * The id column is set by default in the DB class.
+ */
+ public int $id;
+
+ protected static DB $DB;
+
+ public static function __constructStatic() {
+ self::$DB = new DB();
+ }
+}
+
+DBModel::__constructStatic();