private function mergeRoadOfLifeObjects(\UR\DB\NewBundle\Entity\RoadOfLife $dataMasterRoadOfLife, \UR\DB\NewBundle\Entity\RoadOfLife $toBeDeletedRoadOfLife) { $dataMasterRoadOfLife->setLabel($this->mergeStrings($dataMasterRoadOfLife->getLabel(), $toBeDeletedRoadOfLife->getLabel())); $dataMasterRoadOfLife->setCountry($this->mergeCountryObject($dataMasterRoadOfLife->getCountry(), $toBeDeletedRoadOfLife->getCountry())); $dataMasterRoadOfLife->setTerritory($this->mergeTerritoryObject($dataMasterRoadOfLife->getTerritory(), $toBeDeletedRoadOfLife->getTerritory())); $dataMasterRoadOfLife->setLocation($this->mergeLocationObject($dataMasterRoadOfLife->getLocation(), $toBeDeletedRoadOfLife->getLocation())); $dataMasterRoadOfLife->setFromDate($this->mergeDateReference($dataMasterRoadOfLife->getFromDate(), $toBeDeletedRoadOfLife->getFromDate())); $dataMasterRoadOfLife->setToDate($this->mergeDateReference($dataMasterRoadOfLife->getToDate(), $toBeDeletedRoadOfLife->getToDate())); $dataMasterRoadOfLife->setProvenDate($this->mergeDateReference($dataMasterRoadOfLife->getProvenDate(), $toBeDeletedRoadOfLife->getProvenDate())); $dataMasterRoadOfLife->setComment($this->mergeStrings($dataMasterRoadOfLife->getComment(), $toBeDeletedRoadOfLife->getComment())); $dataMasterRoadOfLife->setJob($this->mergeJobObject($dataMasterRoadOfLife->getJob(), $toBeDeletedRoadOfLife->getJob())); $dataMasterRoadOfLife->setOriginCountry($this->mergeCountryObject($dataMasterRoadOfLife->getOriginCountry(), $toBeDeletedRoadOfLife->getOriginCountry())); $dataMasterRoadOfLife->setOriginTerritory($this->mergeTerritoryObject($dataMasterRoadOfLife->getOriginTerritory(), $toBeDeletedRoadOfLife->getOriginTerritory())); $toBeDeletedRoadOfLife->setFromDate(null); $toBeDeletedRoadOfLife->setProvenDate(null); $toBeDeletedRoadOfLife->setToDate(null); return $dataMasterRoadOfLife; }
public function migrateRoadOfLife($person, $roadOfLifeOrder, $originCountry = null, $originTerritory = null, $job = null, $country = null, $territory = null, $location = null, $fromDate = null, $toDate = null, $provenDate = null, $comment = null) { //insert into new data $newRoadOfLife = new RoadOfLife(); $newRoadOfLife->setPerson($person); $newRoadOfLife->setRoadOfLifeOrder($roadOfLifeOrder); $newRoadOfLife->setOriginCountry($this->getCountry($originCountry)); $newRoadOfLife->setOriginTerritory($this->getTerritory($originTerritory)); $newRoadOfLife->setJob($this->getJob($job)); $newRoadOfLife->setCountry($this->getCountry($country)); $newRoadOfLife->setTerritory($this->getTerritory($territory, $location)); $newRoadOfLife->setLocation($this->getLocation($location)); $newRoadOfLife->setFromDate($this->getDate($fromDate)); $newRoadOfLife->setToDate($this->getDate($toDate)); $newRoadOfLife->setProvenDate($this->getDate($provenDate)); $newRoadOfLife->setComment($this->normalize($comment)); $this->getDBManager()->persist($newRoadOfLife); $this->getDBManager()->flush(); }