public function delete($id) { $this->db->trans_start(); # remove company task $this->load->model("CompanyTaskModel"); $task = new CompanyTaskModel(); $task->delete_by_company($id); # remove company achievement $this->load->model("AchievementModel"); $achievement = new AchievementModel(); $achievement->delete_by_company($id); # remove people and people photo $this->load->model("PeopleModel"); $people = new PeopleModel(); $people->delete_by_company($id); # remove company activity $this->load->model("CompanyActivityModel"); $activity = new CompanyActivityModel(); $activity->delete_by_company($id); # remove company photo $this->load->model("CompanyPhotoModel"); $photo = new CompanyPhotoModel(); $photo->delete_by_company($id); # remove follower record $this->load->model("FollowerModel"); $follower = new FollowerModel(); $follower->delete_by_company($id); # remove all job, application and bookmark $this->load->model("JobModel"); $job = new JobModel(); $job->delete_by_company($id); # remove all section, application and bookmark $this->load->model("CompanySectionModel"); $job = new CompanySectionModel(); $job->delete_by_company($id); # remove the company itself $condition = array(CompanyModel::$primary_key => $id); $this->db->delete(CompanyModel::$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(); }