public function addCampaignData() { $form_values = $this->form_values; $campaign_data = new CampaignData(); $campaign_id = $this->_em->find('Campaigns', $form_values['campaign_id']); $campaign_data->setCampaign($campaign_id); $item_id = $this->_em->find('ItemPackSizes', $form_values['item_id']); $campaign_data->setItemPackSize($item_id); list($warehouse_id, $location_id) = explode("_", $form_values['wh_id']); $wh_id = $this->_em->find('Warehouses', $warehouse_id); $campaign_data->setWarehouse($wh_id); $loc_id = $this->_em->find('Locations', $location_id); $campaign_data->setUnionCouncil($loc_id); $campaign_data->setCampaignDay($form_values['campaign_day']); $campaign_data->setDailyTarget($form_values['daily_target']); $campaign_data->setHouseholdVisited($form_values['household_visited']); $campaign_data->setMultipleFamilyHousehold($form_values['multiple_family_household']); $campaign_data->setTargetAgeSixMonths($form_values['target_age_six_months']); $campaign_data->setTargetAgeSixtyMonths($form_values['target_age_sixty_months']); $campaign_data->setTotalCoverage($form_values['total_coverage']); $campaign_data->setRefusalCovered($form_values['refusal_covered']); $campaign_data->setCoverageMobileChildren($form_values['coverage_mobile_children']); $campaign_data->setCoverageNotAccessible($form_values['coverage_not_accessible']); $campaign_data->setRecordNotAccessible($form_values['record_not_accessible']); $campaign_data->setRecordRefusal($form_values['record_refusal']); $campaign_data->setReportedWithWeakness($form_values['reported_with_weakness']); $campaign_data->setZeroDoses($form_values['zero_dose']); $campaign_data->setTeamsReported($form_values['teams_reported']); $campaign_data->setInaccessibleCoverage($form_values['inaccessible_coverage']); $campaign_data->setVialsGiven($form_values['vials_given']); $campaign_data->setVialsUsed($form_values['vials_used']); $campaign_data->setVialsReturned($form_values['vials_returned']); $campaign_data->setVialsExpired($form_values['vials_expired']); $campaign_data->setReconSyrWasted($form_values['recon_syr_wasted']); $campaign_data->setAdSyrWasted($form_values['ad_syr_wasted']); $user_id = $this->_em->find('Users', $this->_identity->getIdentity()); $campaign_data->setCreatedDate(App_Tools_Time::now()); $campaign_data->setCreatedBy($user_id); $campaign_data->setModifiedBy($user_id); $campaign_data->setModifiedDate(App_Tools_Time::now()); $dist_id = $this->_em->find('Locations', $form_values['district_id']); $campaign_data->setDistrict($dist_id); $this->_em->persist($campaign_data); $this->_em->flush(); $last_id_camp_data = $campaign_data->getPkId(); /* $camp_targets = new CampaignTargets(); $camp_targets->setCampaign($campaign_id); $camp_targets->setDailyTarget($form_values['daily_target']); //$camp_targets->setLocation(); $camp_targets->setCreatedDate(new \DateTime(date("Y-m-d"))); $camp_targets->setCreatedBy($user_id); $this->_em->persist($camp_targets); $this->_em->flush(); $last_id_camp_target = $camp_targets->getPkId(); */ /* $camp_data_update = $this->_table->find($last_id_camp_data); $camp_data_update->setCampaignTarget($last_id_camp_target); $this->_em->persist($camp_data_update); $this->_em->flush(); */ }