From 7d845c9e752c92eabf5005f2bd310cf360991c1a Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 1 Apr 2021 09:25:09 +0300 Subject: Added the id property in DBModel --- src/index.php | 2 +- src/models/DBModel.php | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/index.php b/src/index.php index 6f290d6..5fefff4 100644 --- a/src/index.php +++ b/src/index.php @@ -4,6 +4,6 @@ $jb = new JobOffer("a", "", "", 0); foreach(JobOffer::getAll() as $key => $obj) { - echo $obj->salary . "
"; + echo $obj->id . "
"; } ?> diff --git a/src/models/DBModel.php b/src/models/DBModel.php index 6980446..859ea97 100644 --- a/src/models/DBModel.php +++ b/src/models/DBModel.php @@ -2,6 +2,12 @@ include_once("DB.php"); abstract class DBModel { + /** + * Used ONLY for gotten values form the database. Mustn't be assigned to, since it's AUTO_INCREMENT. + * The id column is set by default in the DB class. + */ + public int $id; + protected static DB $DB; public static function __constructStatic() { -- cgit v1.3.1-26-gb76a