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