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

27 lines
654 B
PHP
Raw Normal View History

2023-02-05 15:56:21 +00:00
<?php
namespace jobs\Entity;
2023-02-05 23:35:31 +00:00
class Enquiry { //Represents enquiry Entity from enquiries table
2023-02-05 15:56:21 +00:00
public $id;
public $name;
public $email;
public $telephone;
public $enquiry;
public $completed;
public $admin_id;
private $usersTable;
public function __construct(\jobs\JobDatabaseTable $usersTable) {
$this->usersTable = $usersTable;
}
2023-02-05 23:35:31 +00:00
public function getAdmin() { //Get the admin that completed the enquiry
2023-02-05 16:13:36 +00:00
if ($this->completed == 'y') {
2023-02-05 15:56:21 +00:00
return $this->usersTable->find(['id'], ['value0' => $this->admin_id])[0];
}
2023-02-05 16:13:36 +00:00
else {
2023-02-05 15:56:21 +00:00
return 'N/A';
}
}
}
?>