From 018c046d859c3e53c18846963bee333eb81d08b2 Mon Sep 17 00:00:00 2001 From: Joshua Perry <45966243+jpez-development@users.noreply.github.com> Date: Mon, 23 Jan 2023 14:37:23 +0000 Subject: [PATCH] Updated database tables to include entities --- CSY2028/EntryPoint.php | 4 ++++ jobs/Routes.php | 10 +++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CSY2028/EntryPoint.php b/CSY2028/EntryPoint.php index b9d780f..ef2c359 100644 --- a/CSY2028/EntryPoint.php +++ b/CSY2028/EntryPoint.php @@ -22,6 +22,10 @@ class EntryPoint { list($controllerName, $functionName) = \explode('/', $route); + if ($functionName == '') { + $functionName = 'home'; + } + if ($_SERVER['REQUEST_METHOD'] == 'POST') { $functionName = $functionName . 'Submit'; } diff --git a/jobs/Routes.php b/jobs/Routes.php index 970efb4..6c3ebbd 100644 --- a/jobs/Routes.php +++ b/jobs/Routes.php @@ -2,19 +2,19 @@ namespace jobs; class Routes implements \CSY2028\Routes { public function getController($name) { - //TODO: Add Database Tables - //Remember entities - $jobsTable = new \CSY2028\DatabaseTable('jobs', 'id'); + $catsTable = new \CSY2028\DatabaseTable('category', 'id', '\jobs\Entity\Category'); + $jobsTable = new \CSY2028\DatabaseTable('jobs', 'id', '\jobs\Entity\Job', [$catsTable]); + $appsTable = new \CSY2028\DatabaseTable('applicants', 'id', '\jobs\Entity\Applicant', [$jobsTable]); $controllers = []; //TODO: Add Controllers - $controllers['home'] = new \jobs\controllers\Home($jobsTable); + $controllers['jobs'] = new \jobs\controllers\Jobs($jobsTable); return $controllers[$name]; } public function getDefaultRoute() { - return 'home/home'; + return 'jobs/home'; } public function checkLogin($route) {