public function migrateEducation($person, $educationOrder, $label, $country = null, $territory = null, $location = null, $fromDate = null, $toDate = null, $provenDate = null, $graduationLabel = null, $graduationDate = null, $graduationLocation = null, $comment = null) { //insert into new data $newEducation = new Education(); $newEducation->setPerson($person); $newEducation->setEducationOrder($educationOrder); $newEducation->setLabel($this->normalize($label)); $newEducation->setCountry($this->getCountry($country)); $newEducation->setTerritory($this->getTerritory($territory, $location)); $newEducation->setLocation($this->getLocation($location)); $newEducation->setFromDate($this->getDate($fromDate)); $newEducation->setToDate($this->getDate($toDate)); $newEducation->setProvenDate($this->getDate($provenDate)); $newEducation->setGraduationLabel($this->normalize($graduationLabel)); $newEducation->setGraduationDate($this->getDate($graduationDate)); $newEducation->setGraduationLocation($this->getLocation($graduationLocation)); $newEducation->setComment($this->normalize($comment)); $this->getDBManager()->persist($newEducation); $this->getDBManager()->flush(); }
private function mergeEducationObjects(\UR\DB\NewBundle\Entity\Education $dataMasterEducation, \UR\DB\NewBundle\Entity\Education $toBeDeletedEducation) { $dataMasterEducation->setLabel($this->mergeStrings($dataMasterEducation->getLabel(), $toBeDeletedEducation->getLabel())); $dataMasterEducation->setCountry($this->mergeCountryObject($dataMasterEducation->getCountry(), $toBeDeletedEducation->getCountry())); $dataMasterEducation->setTerritory($this->mergeTerritoryObject($dataMasterEducation->getTerritory(), $toBeDeletedEducation->getTerritory())); $dataMasterEducation->setLocation($this->mergeLocationObject($dataMasterEducation->getLocation(), $toBeDeletedEducation->getLocation())); $dataMasterEducation->setFromDate($this->mergeDateReference($dataMasterEducation->getFromDate(), $toBeDeletedEducation->getFromDate())); $dataMasterEducation->setToDate($this->mergeDateReference($dataMasterEducation->getToDate(), $toBeDeletedEducation->getToDate())); $dataMasterEducation->setProvenDate($this->mergeDateReference($dataMasterEducation->getProvenDate(), $toBeDeletedEducation->getProvenDate())); $dataMasterEducation->setComment($this->mergeStrings($dataMasterEducation->getComment(), $toBeDeletedEducation->getComment())); $dataMasterEducation->setGraduationLabel($this->mergeStrings($dataMasterEducation->getGraduationLabel(), $toBeDeletedEducation->getGraduationLabel())); $dataMasterEducation->setGraduationDate($this->mergeDateReference($dataMasterEducation->getGraduationDate(), $toBeDeletedEducation->getGraduationDate())); $dataMasterEducation->setGraduationLocation($this->mergeLocationObject($dataMasterEducation->getGraduationLocation(), $toBeDeletedEducation->getGraduationLocation())); $toBeDeletedEducation->setFromDate(null); $toBeDeletedEducation->setProvenDate(null); $toBeDeletedEducation->setToDate(null); $toBeDeletedEducation->setGraduationDate(null); return $dataMasterEducation; }
public function matchingEducation(\UR\DB\NewBundle\Entity\Education $educationOne, \UR\DB\NewBundle\Entity\Education $educationTwo, $allowLessInformation = false) { $this->LOGGER->debug("Comparing " . $educationOne . " with " . $educationTwo); if (!$this->compareStrings($educationOne->getLabel(), $educationTwo->getLabel(), $allowLessInformation)) { return false; } if (!$this->compareCountries($educationOne->getCountry(), $educationTwo->getCountry(), $allowLessInformation)) { return false; } if (!$this->compareTerritories($educationOne->getTerritory(), $educationTwo->getTerritory(), $allowLessInformation)) { return false; } if (!$this->compareLocations($educationOne->getLocation(), $educationTwo->getLocation(), $allowLessInformation)) { return false; } if ($this->unmatchedArrays($educationOne->getFromDate(), $educationTwo->getFromDate(), "date", $allowLessInformation)) { return false; } if ($this->unmatchedArrays($educationOne->getToDate(), $educationTwo->getToDate(), "date", $allowLessInformation)) { return false; } if ($this->unmatchedArrays($educationOne->getProvenDate(), $educationTwo->getProvenDate(), "date", $allowLessInformation)) { return false; } if (!$this->compareStrings($educationOne->getGraduationLabel(), $educationTwo->getGraduationLabel(), $allowLessInformation)) { return false; } if (!$this->compareLocations($educationOne->getGraduationLocation(), $educationTwo->getGraduationLocation(), $allowLessInformation)) { return false; } if ($this->unmatchedArrays($educationOne->getGraduationDate(), $educationTwo->getGraduationDate(), "date")) { if (!$allowLessInformation || $this->checkIfOneValueContainsMoreInformation($educationOne->getGraduationDate(), $educationTwo->getGraduationDate())) { return false; } } return true; }