public function delete($id, $company = null) { $this->db->trans_start(); $this->load->model("BookmarkModel"); $this->load->model("ApplicationModel"); # delete bookmark related by job $bookmark = new BookmarkModel(); $bookmark->delete_by_job($id); # delete application related by job $application = new ApplicationModel(); $application->delete_by_job($id); # remove the job itself $condition = array(JobModel::$primary_key => $id); if ($company != null) { $condition["job_company"] = $company; } $this->db->delete(JobModel::$table_name, $condition); $this->db->trans_complete(); return $this->db->trans_status(); }