private function mergeHonourObjects(\UR\DB\NewBundle\Entity\Honour $dataMasterHonour, \UR\DB\NewBundle\Entity\Honour $toBeDeletedHonour) { $dataMasterHonour->setLabel($this->mergeStrings($dataMasterHonour->getLabel(), $toBeDeletedHonour->getLabel())); $dataMasterHonour->setCountry($this->mergeCountryObject($dataMasterHonour->getCountry(), $toBeDeletedHonour->getCountry())); $dataMasterHonour->setTerritory($this->mergeTerritoryObject($dataMasterHonour->getTerritory(), $toBeDeletedHonour->getTerritory())); $dataMasterHonour->setLocation($this->mergeLocationObject($dataMasterHonour->getLocation(), $toBeDeletedHonour->getLocation())); $dataMasterHonour->setFromDate($this->mergeDateReference($dataMasterHonour->getFromDate(), $toBeDeletedHonour->getFromDate())); $dataMasterHonour->setToDate($this->mergeDateReference($dataMasterHonour->getToDate(), $toBeDeletedHonour->getToDate())); $dataMasterHonour->setProvenDate($this->mergeDateReference($dataMasterHonour->getProvenDate(), $toBeDeletedHonour->getProvenDate())); $dataMasterHonour->setComment($this->mergeStrings($dataMasterHonour->getComment(), $toBeDeletedHonour->getComment())); $toBeDeletedHonour->setFromDate(null); $toBeDeletedHonour->setProvenDate(null); $toBeDeletedHonour->setToDate(null); return $dataMasterHonour; }
public function migrateHonour($person, $honourOrder, $label, $country = null, $territory = null, $location = null, $fromDate = null, $toDate = null, $provenDate = null, $comment = null) { //insert into new data $newHonour = new Honour(); $newHonour->setPerson($person); $newHonour->setHonourOrder($honourOrder); $newHonour->setLabel($this->normalize($label)); $newHonour->setCountry($this->getCountry($country)); $newHonour->setTerritory($this->getTerritory($territory, $location)); $newHonour->setLocation($this->getLocation($location)); $newHonour->setFromDate($this->getDate($fromDate)); $newHonour->setToDate($this->getDate($toDate)); $newHonour->setProvenDate($this->getDate($provenDate)); $newHonour->setComment($this->normalize($comment)); $this->getDBManager()->persist($newHonour); $this->getDBManager()->flush(); }