예제 #1
0
 public function migrateWedding($weddingOrder, $personOne, $personTwo, $weddingDate = null, $weddingLocation = null, $weddingTerritory = null, $bannsDate = null, $breakupReason = null, $breakupDate = null, $marriageComment = null, $beforeAfter = null, $comment = null, $provenDate = null)
 {
     //create new wedding obj
     $newWedding = new Wedding();
     $husband = $personOne;
     $wife = $personTwo;
     if ($personTwo != null && $personTwo->getGender() == 1 || $personOne != null && $personOne->getGender() == 2) {
         //personTwo is husband, since he is male or personOne is female
         $husband = $personTwo;
         $wife = $personOne;
     }
     $this->LOGGER->info("Adding wedding between Husband: " . $husband . " and Wife: " . $wife . " at order: " . $weddingOrder);
     $newWedding->setHusbandId($husband != null ? $husband->getId() : null);
     $newWedding->setWifeId($wife != null ? $wife->getId() : null);
     $newWedding->setWeddingOrder($weddingOrder);
     $newWedding->setWeddingDate($this->getDate($weddingDate));
     $newWedding->setWeddingLocation($this->getLocation($weddingLocation));
     $newWedding->setWeddingTerritory($this->getTerritory($weddingTerritory, $weddingLocation));
     $newWedding->setBannsDate($this->getDate($bannsDate));
     $newWedding->setBreakupReason($this->normalize($breakupReason));
     $newWedding->setBreakupDate($this->getDate($breakupDate));
     $newWedding->setMarriageComment($this->normalize($marriageComment));
     $newWedding->setBeforeAfter($beforeAfter);
     $newWedding->setComment($this->normalize($comment));
     $newWedding->setProvenDate($this->getDate($provenDate));
     $existingWedding = $this->checkIfWeddingAlreadyExists($weddingOrder, $personOne, $personTwo);
     if (is_null($existingWedding)) {
         //persist new wedding obj
         $this->getDBManager()->persist($newWedding);
         $this->getDBManager()->flush();
     } else {
         //merge with existing wedding
         $this->LOGGER->info("Merging new wedding with existing wedding.");
         $existingWedding = $this->get("person_merging.service")->createMergedWeddingObj($existingWedding, $newWedding);
         $this->getDBManager()->persist($existingWedding);
         $this->getDBManager()->flush();
     }
 }
예제 #2
0
 public function createMergedWeddingObj(\UR\DB\NewBundle\Entity\Wedding $dataMasterWedding, \UR\DB\NewBundle\Entity\Wedding $toBeDeletedWedding)
 {
     //husband/ wife?
     $dataMasterWedding->setWeddingDate($this->mergeDateReference($dataMasterWedding->getWeddingDate(), $toBeDeletedWedding->getWeddingDate()));
     $dataMasterWedding->setWeddingLocation($this->mergeLocationObject($dataMasterWedding->getWeddingLocation(), $toBeDeletedWedding->getWeddingLocation()));
     $dataMasterWedding->setWeddingTerritory($this->mergeTerritoryObject($dataMasterWedding->getWeddingTerritory(), $toBeDeletedWedding->getWeddingTerritory()));
     $dataMasterWedding->setBannsDate($this->mergeDateReference($dataMasterWedding->getBannsDate(), $toBeDeletedWedding->getBannsDate()));
     $dataMasterWedding->setBreakupReason($this->mergeStrings($dataMasterWedding->getBreakupReason(), $toBeDeletedWedding->getBreakupReason()));
     $dataMasterWedding->setBreakupDate($this->mergeDateReference($dataMasterWedding->getBreakupDate(), $toBeDeletedWedding->getBreakupDate()));
     $dataMasterWedding->setMarriageComment($this->mergeComment($dataMasterWedding->getMarriageComment(), $toBeDeletedWedding->getMarriageComment()));
     $dataMasterWedding->setBeforeAfter($this->mergeStrings($dataMasterWedding->getBeforeAfter(), $toBeDeletedWedding->getBeforeAfter()));
     $dataMasterWedding->setProvenDate($this->mergeDateReference($dataMasterWedding->getProvenDate(), $toBeDeletedWedding->getProvenDate()));
     $dataMasterWedding->setComment($this->mergeComment($dataMasterWedding->getComment(), $toBeDeletedWedding->getComment()));
     $toBeDeletedWedding->setWeddingDate(null);
     $toBeDeletedWedding->setBannsDate(null);
     $toBeDeletedWedding->setBreakupDate(null);
     $toBeDeletedWedding->setProvenDate(null);
     return $dataMasterWedding;
 }
예제 #3
0
 public function matchingWedding(\UR\DB\NewBundle\Entity\Wedding $weddingOne, \UR\DB\NewBundle\Entity\Wedding $weddingTwo, $allowLessInformation = false)
 {
     $this->LOGGER->debug("Comparing " . $weddingOne . " with " . $weddingTwo);
     if ($this->unmatchedArrays($weddingOne->getWeddingDate(), $weddingTwo->getWeddingDate(), "date", $allowLessInformation)) {
         return false;
     }
     if (!$this->compareTerritories($weddingOne->getWeddingTerritory(), $weddingTwo->getWeddingTerritory(), $allowLessInformation)) {
         return false;
     }
     if (!$this->compareLocations($weddingOne->getWeddingLocation(), $weddingTwo->getWeddingLocation(), $allowLessInformation)) {
         return false;
     }
     if ($this->unmatchedArrays($weddingOne->getBannsDate(), $weddingTwo->getBannsDate(), "date", $allowLessInformation)) {
         return false;
     }
     if (!$this->compareStrings($weddingOne->getBreakupReason(), $weddingTwo->getBreakupReason(), $allowLessInformation)) {
         return false;
     }
     if ($this->unmatchedArrays($weddingOne->getBreakupDate(), $weddingTwo->getBreakupDate(), "date", $allowLessInformation)) {
         return false;
     }
     if ($this->unmatchedArrays($weddingOne->getProvenDate(), $weddingTwo->getProvenDate(), "date", $allowLessInformation)) {
         return false;
     }
     if (!$this->compareStrings($weddingOne->getBeforeAfter(), $weddingTwo->getBeforeAfter(), $allowLessInformation)) {
         return false;
     }
     //marriage comment?
     return true;
 }