public function execute() { $departmentId = $_REQUEST['department']; if (is_null($departmentId) || !isset($departmentId)) { throw new \InvalidArgumentException('Missing department id.'); } $department = DepartmentFactory::getDepartmentById($departmentId); $faculty = FacultyFactory::getFacultyByDepartmentAssoc($department); echo json_encode($faculty); exit; // Exit since this is called by JSON }
private function get() { $id = $_GET['id']; if (!isset($id) || $id == '') { throw new \InvalidArgumentException('Missing faculty ID.'); } $faculty = FacultyFactory::getFacultyById($id); if (empty($faculty)) { header('HTTP/1.1 404 Not Found'); exit; } echo json_encode($faculty); exit; }
/** * Get the Faculty Supervisor object associated with this internship. * */ public function getFaculty() { if (!isset($this->faculty_id)) { return null; } return FacultyFactory::getFacultyObjectById($this->faculty_id); }