private function mergeResidenceObjects(\UR\DB\NewBundle\Entity\Residence $dataMasterResidence, \UR\DB\NewBundle\Entity\Residence $toBeDeletedResidence) { $dataMasterResidence->setResidenceCountry($this->mergeCountryObject($dataMasterResidence->getResidenceCountry(), $toBeDeletedResidence->getResidenceCountry())); $dataMasterResidence->setResidenceTerritory($this->mergeTerritoryObject($dataMasterResidence->getResidenceTerritory(), $toBeDeletedResidence->getResidenceTerritory())); $dataMasterResidence->setResidenceLocation($this->mergeLocationObject($dataMasterResidence->getResidenceLocation(), $toBeDeletedResidence->getResidenceLocation())); return $dataMasterResidence; }
public function migrateResidence($person, $residenceOrder, $residenceCountry, $residenceTerritory = null, $residenceLocation = null) { //insert into new data $newResidence = new Residence(); $newResidence->setPerson($person); $newResidence->setResidenceOrder($residenceOrder); $newResidence->setResidenceCountry($this->getCountry($residenceCountry)); $newResidence->setResidenceTerritory($this->getTerritory($residenceTerritory, $residenceLocation)); $newResidence->setResidenceLocation($this->getLocation($residenceLocation)); $this->getDBManager()->persist($newResidence); $this->getDBManager()->flush(); }