예제 #1
0
 private function setHusbandAndWife(\UR\DB\NewBundle\Entity\BasePerson $dataMaster, \UR\DB\NewBundle\Entity\BasePerson $mergedPerson, \UR\DB\NewBundle\Entity\Wedding $newWedding)
 {
     $husband = $dataMaster;
     $wife = $mergedPerson;
     if ($mergedPerson != null && $mergedPerson->getGender() == 1 || $dataMaster != null && $dataMaster->getGender() == 2) {
         //personTwo is husband, since he is male or personOne is female
         $husband = $mergedPerson;
         $wife = $dataMaster;
     }
     $newWedding->setHusbandId($husband != null ? $husband->getId() : null);
     $newWedding->setWifeId($wife != null ? $wife->getId() : null);
 }
예제 #2
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();
     }
 }