From 1bc4dc0f2aab43cc527fe449b2e2701abab35d1b Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 1 Apr 2021 12:26:22 +0300 Subject: Moved static functionality of Company and JobOffer below the dynamic one --- src/models/JobOffer.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src/models/JobOffer.php') diff --git a/src/models/JobOffer.php b/src/models/JobOffer.php index 555e7f4..3ec4b77 100644 --- a/src/models/JobOffer.php +++ b/src/models/JobOffer.php @@ -6,14 +6,6 @@ include_once("Company.php"); * Model that contains the required JobOffer properties. It also contains the request methods to the job_offers table. */ class JobOffer extends DBModel { - public const TABLE_NAME = "job_offers"; - public const TABLE_COLUMNS = array( - "title " . DB::STRING_TYPE, - "description " . DB::STRING_TYPE, - "companyId " . DB::INTEGER_TYPE, // Requires a foreign key - "salary " . DB::FLOAT_TYPE, - ); - public string $title; public string $description; public int $companyId; @@ -26,6 +18,18 @@ class JobOffer extends DBModel { $this->salary = $salary; } + /* + * Everything from here is static functionality + */ + + public const TABLE_NAME = "job_offers"; + public const TABLE_COLUMNS = array( + "title " . DB::STRING_TYPE, + "description " . DB::STRING_TYPE, + "companyId " . DB::INTEGER_TYPE, // Requires a foreign key + "salary " . DB::FLOAT_TYPE, + ); + static function __constructStatic() { $foreignKeys = array( DB::genFK("companyId", Company::TABLE_NAME, "id") -- cgit v1.3.1-23-gd82d