private function mergeWorkObjects(\UR\DB\NewBundle\Entity\Works $dataMasterWork, \UR\DB\NewBundle\Entity\Works $toBeDeletedWork)
 {
     $dataMasterWork->setLabel($this->mergeStrings($dataMasterWork->getLabel(), $toBeDeletedWork->getLabel()));
     $dataMasterWork->setCountry($this->mergeCountryObject($dataMasterWork->getCountry(), $toBeDeletedWork->getCountry()));
     $dataMasterWork->setTerritory($this->mergeTerritoryObject($dataMasterWork->getTerritory(), $toBeDeletedWork->getTerritory()));
     $dataMasterWork->setLocation($this->mergeLocationObject($dataMasterWork->getLocation(), $toBeDeletedWork->getLocation()));
     $dataMasterWork->setFromDate($this->mergeDateReference($dataMasterWork->getFromDate(), $toBeDeletedWork->getFromDate()));
     $dataMasterWork->setToDate($this->mergeDateReference($dataMasterWork->getToDate(), $toBeDeletedWork->getToDate()));
     $dataMasterWork->setProvenDate($this->mergeDateReference($dataMasterWork->getProvenDate(), $toBeDeletedWork->getProvenDate()));
     $dataMasterWork->setComment($this->mergeStrings($dataMasterWork->getComment(), $toBeDeletedWork->getComment()));
     $toBeDeletedWork->setFromDate(null);
     $toBeDeletedWork->setProvenDate(null);
     $toBeDeletedWork->setToDate(null);
     return $dataMasterWork;
 }
Exemple #2
0
 public function migrateWork($person, $label, $works_order, $country = null, $location = null, $fromDate = null, $toDate = null, $territory = null, $provenDate = null, $comment = null)
 {
     //insert into new data
     $newWorks = new Works();
     $newWorks->setPerson($person);
     $newWorks->setLabel($this->normalize($label));
     $newWorks->setWorksOrder($works_order);
     $newWorks->setCountry($this->getCountry($country));
     $newWorks->setLocation($this->getLocation($location));
     $newWorks->setFromDate($this->getDate($fromDate));
     $newWorks->setToDate($this->getDate($toDate));
     $newWorks->setTerritory($this->getTerritory($territory, $location));
     $newWorks->setProvenDate($this->getDate($provenDate));
     $newWorks->setComment($this->normalize($comment));
     $this->getDBManager()->persist($newWorks);
     $this->getDBManager()->flush();
 }