private function mergeEducationObjects(\UR\DB\NewBundle\Entity\Education $dataMasterEducation, \UR\DB\NewBundle\Entity\Education $toBeDeletedEducation) { $dataMasterEducation->setLabel($this->mergeStrings($dataMasterEducation->getLabel(), $toBeDeletedEducation->getLabel())); $dataMasterEducation->setCountry($this->mergeCountryObject($dataMasterEducation->getCountry(), $toBeDeletedEducation->getCountry())); $dataMasterEducation->setTerritory($this->mergeTerritoryObject($dataMasterEducation->getTerritory(), $toBeDeletedEducation->getTerritory())); $dataMasterEducation->setLocation($this->mergeLocationObject($dataMasterEducation->getLocation(), $toBeDeletedEducation->getLocation())); $dataMasterEducation->setFromDate($this->mergeDateReference($dataMasterEducation->getFromDate(), $toBeDeletedEducation->getFromDate())); $dataMasterEducation->setToDate($this->mergeDateReference($dataMasterEducation->getToDate(), $toBeDeletedEducation->getToDate())); $dataMasterEducation->setProvenDate($this->mergeDateReference($dataMasterEducation->getProvenDate(), $toBeDeletedEducation->getProvenDate())); $dataMasterEducation->setComment($this->mergeStrings($dataMasterEducation->getComment(), $toBeDeletedEducation->getComment())); $dataMasterEducation->setGraduationLabel($this->mergeStrings($dataMasterEducation->getGraduationLabel(), $toBeDeletedEducation->getGraduationLabel())); $dataMasterEducation->setGraduationDate($this->mergeDateReference($dataMasterEducation->getGraduationDate(), $toBeDeletedEducation->getGraduationDate())); $dataMasterEducation->setGraduationLocation($this->mergeLocationObject($dataMasterEducation->getGraduationLocation(), $toBeDeletedEducation->getGraduationLocation())); $toBeDeletedEducation->setFromDate(null); $toBeDeletedEducation->setProvenDate(null); $toBeDeletedEducation->setToDate(null); $toBeDeletedEducation->setGraduationDate(null); return $dataMasterEducation; }
public function migrateEducation($person, $educationOrder, $label, $country = null, $territory = null, $location = null, $fromDate = null, $toDate = null, $provenDate = null, $graduationLabel = null, $graduationDate = null, $graduationLocation = null, $comment = null) { //insert into new data $newEducation = new Education(); $newEducation->setPerson($person); $newEducation->setEducationOrder($educationOrder); $newEducation->setLabel($this->normalize($label)); $newEducation->setCountry($this->getCountry($country)); $newEducation->setTerritory($this->getTerritory($territory, $location)); $newEducation->setLocation($this->getLocation($location)); $newEducation->setFromDate($this->getDate($fromDate)); $newEducation->setToDate($this->getDate($toDate)); $newEducation->setProvenDate($this->getDate($provenDate)); $newEducation->setGraduationLabel($this->normalize($graduationLabel)); $newEducation->setGraduationDate($this->getDate($graduationDate)); $newEducation->setGraduationLocation($this->getLocation($graduationLocation)); $newEducation->setComment($this->normalize($comment)); $this->getDBManager()->persist($newEducation); $this->getDBManager()->flush(); }