public function migrateProperty($person, $propertyOrder, $label, $country = null, $territory = null, $location = null, $fromDate = null, $toDate = null, $provenDate = null, $comment = null) { //insert into new data $newProperty = new Property(); $newProperty->setPerson($person); $newProperty->setPropertyOrder($propertyOrder); $newProperty->setLabel($this->normalize($label)); $newProperty->setCountry($this->getCountry($country)); $newProperty->setTerritory($this->getTerritory($territory, $location)); $newProperty->setLocation($this->getLocation($location)); $newProperty->setFromDate($this->getDate($fromDate)); $newProperty->setToDate($this->getDate($toDate)); $newProperty->setProvenDate($this->getDate($provenDate)); $newProperty->setComment($this->normalize($comment)); $this->getDBManager()->persist($newProperty); $this->getDBManager()->flush(); }
private function mergePropertyObjects(\UR\DB\NewBundle\Entity\Property $dataMasterProperty, \UR\DB\NewBundle\Entity\Property $toBeDeletedProperty) { $dataMasterProperty->setLabel($this->mergeStrings($dataMasterProperty->getLabel(), $toBeDeletedProperty->getLabel())); $dataMasterProperty->setCountry($this->mergeCountryObject($dataMasterProperty->getCountry(), $toBeDeletedProperty->getCountry())); $dataMasterProperty->setTerritory($this->mergeTerritoryObject($dataMasterProperty->getTerritory(), $toBeDeletedProperty->getTerritory())); $dataMasterProperty->setLocation($this->mergeLocationObject($dataMasterProperty->getLocation(), $toBeDeletedProperty->getLocation())); $dataMasterProperty->setFromDate($this->mergeDateReference($dataMasterProperty->getFromDate(), $toBeDeletedProperty->getFromDate())); $dataMasterProperty->setToDate($this->mergeDateReference($dataMasterProperty->getToDate(), $toBeDeletedProperty->getToDate())); $dataMasterProperty->setProvenDate($this->mergeDateReference($dataMasterProperty->getProvenDate(), $toBeDeletedProperty->getProvenDate())); $dataMasterProperty->setComment($this->mergeStrings($dataMasterProperty->getComment(), $toBeDeletedProperty->getComment())); $toBeDeletedProperty->setFromDate(null); $toBeDeletedProperty->setProvenDate(null); $toBeDeletedProperty->setToDate(null); return $dataMasterProperty; }
public function matchingProperty(\UR\DB\NewBundle\Entity\Property $propertyOne, \UR\DB\NewBundle\Entity\Property $propertyTwo, $allowLessInformation = false) { $this->LOGGER->debug("Comparing " . $propertyOne . " with " . $propertyTwo); if (!$this->compareStrings($propertyOne->getLabel(), $propertyTwo->getLabel(), $allowLessInformation)) { return false; } if (!$this->compareCountries($propertyOne->getCountry(), $propertyTwo->getCountry(), $allowLessInformation)) { return false; } if (!$this->compareTerritories($propertyOne->getTerritory(), $propertyTwo->getTerritory(), $allowLessInformation)) { return false; } if (!$this->compareLocations($propertyOne->getLocation(), $propertyTwo->getLocation(), $allowLessInformation)) { return false; } if ($this->unmatchedArrays($propertyOne->getFromDate(), $propertyTwo->getFromDate(), "date", $allowLessInformation)) { return false; } if ($this->unmatchedArrays($propertyOne->getToDate(), $propertyTwo->getToDate(), "date", $allowLessInformation)) { return false; } if ($this->unmatchedArrays($propertyOne->getProvenDate(), $propertyTwo->getProvenDate(), "date", $allowLessInformation)) { return false; } return true; }