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(); }
public function delete($id) { $this->db->trans_start(); # remove bookmark related employee $this->load->model("BookmarkModel"); $bookmark = new BookmarkModel(); $bookmark->delete_by_employee($id); # remove follower related employee $this->load->model("FollowerModel"); $follower = new FollowerModel(); $follower->delete_by_employee($id); # remove activity related employee $this->load->model("EmployeeActivityModel"); $activity = new EmployeeActivityModel(); $activity->delete_by_employee($id); # remove cv list of experience related employee $this->load->model("ExperienceModel"); $experience = new ExperienceModel(); $experience->delete_by_employee($id); # remove cv list of education related employee $this->load->model("PortfolioModel"); $education = new PortfolioModel(); $education->delete_by_employee($id); # remove thread list related employee $this->load->model("ThreadModel"); $thread = new ThreadModel(); $thread->delete_by_employee($id); # remove application ever sent $this->load->model("ApplicationModel"); $application = new ApplicationModel(); $application->delete_by_employee($id); # remove employee itself $condition = array(EmployeeModel::$primary_key => $id); $this->db->delete(EmployeeModel::$table_name, $condition); $this->db->trans_complete(); return $this->db->trans_status(); }