public function delete($id) { $this->db->start_transaction(); # delete company related by city $company = new CompanyModel(); $company->delete_by_location($id); # remove the city itself $condition = array(CityModel::$primary_key => $id); $this->db->delete(CityModel::$table_name, $condition); $this->db->complete_transaction(); return $this->db->transaction_status(); }