CSY2028-assignment-2/jobs/Entity/Job.php

29 lines
802 B
PHP
Raw Normal View History

2023-01-23 14:37:07 +00:00
<?php
namespace jobs\Entity;
2023-02-05 23:35:31 +00:00
class Job { //Represents Job Entity from jobs table
2023-01-23 14:37:07 +00:00
public $id;
2023-01-23 16:08:38 +00:00
public $title;
2023-01-23 14:37:07 +00:00
public $description;
public $salary;
public $closingDate;
public $location;
public $categoryId;
2023-01-25 15:36:45 +00:00
public $clientId;
2023-02-05 13:50:57 +00:00
public $archived;
2023-01-23 14:37:07 +00:00
private $catsTable;
2023-02-05 12:07:01 +00:00
private $appsTable;
2023-01-23 14:37:07 +00:00
2023-02-05 12:07:01 +00:00
public function __construct(\jobs\JobDatabaseTable $catsTable, \jobs\JobDatabaseTable $appsTable) {
2023-01-23 14:37:07 +00:00
$this->catsTable = $catsTable;
2023-02-05 12:07:01 +00:00
$this->appsTable = $appsTable;
2023-01-23 14:37:07 +00:00
}
2023-02-05 23:35:31 +00:00
public function getCat() { //Get category job is in
2023-02-04 22:19:29 +00:00
return $this->catsTable->find(['id'], ['value0' => $this->categoryId])[0];
2023-01-23 14:37:07 +00:00
}
2023-02-05 12:07:01 +00:00
2023-02-05 23:35:31 +00:00
public function getApps() { //Get applicants for job
2023-02-05 12:07:01 +00:00
return $this->appsTable->find(['jobId'], ['value0' => $this->id]);
}
2023-01-25 17:14:23 +00:00
}
?>