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(); }
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; }
public function matchingWork(\UR\DB\NewBundle\Entity\Works $workOne, \UR\DB\NewBundle\Entity\Works $workTwo, $allowLessInformation = false) { $this->LOGGER->debug("Comparing " . $workOne . " with " . $workTwo); if (!$this->compareStrings($workOne->getLabel(), $workTwo->getLabel(), $allowLessInformation)) { return false; } if (!$this->compareCountries($workOne->getCountry(), $workTwo->getCountry(), $allowLessInformation)) { return false; } if (!$this->compareTerritories($workOne->getTerritory(), $workTwo->getTerritory(), $allowLessInformation)) { return false; } if (!$this->compareLocations($workOne->getLocation(), $workTwo->getLocation(), $allowLessInformation)) { return false; } if ($this->unmatchedArrays($workOne->getFromDate(), $workTwo->getFromDate(), "date", $allowLessInformation)) { return false; } if ($this->unmatchedArrays($workOne->getToDate(), $workTwo->getToDate(), "date", $allowLessInformation)) { return false; } if ($this->unmatchedArrays($workOne->getProvenDate(), $workTwo->getProvenDate(), "date", $allowLessInformation)) { return false; } return true; }