public function migrateStatus($person, $statusOrder, $label, $country = null, $territory = null, $location = null, $fromDate = null, $toDate = null, $provenDate = null, $comment = null) { //insert into new data $newStatus = new Status(); $newStatus->setPerson($person); $newStatus->setStatusOrder($statusOrder); $newStatus->setLabel($this->normalize($label)); $newStatus->setCountry($this->getCountry($country)); $newStatus->setTerritory($this->getTerritory($territory, $location)); $newStatus->setLocation($this->getLocation($location)); $newStatus->setFromDate($this->getDate($fromDate)); $newStatus->setToDate($this->getDate($toDate)); $newStatus->setProvenDate($this->getDate($provenDate)); $newStatus->setComment($this->normalize($comment)); $this->getDBManager()->persist($newStatus); $this->getDBManager()->flush(); }
private function mergeStatusObjects(\UR\DB\NewBundle\Entity\Status $dataMasterStatus, \UR\DB\NewBundle\Entity\Status $toBeDeletedStatus) { $dataMasterStatus->setLabel($this->mergeStrings($dataMasterStatus->getLabel(), $toBeDeletedStatus->getLabel())); $dataMasterStatus->setCountry($this->mergeCountryObject($dataMasterStatus->getCountry(), $toBeDeletedStatus->getCountry())); $dataMasterStatus->setTerritory($this->mergeTerritoryObject($dataMasterStatus->getTerritory(), $toBeDeletedStatus->getTerritory())); $dataMasterStatus->setLocation($this->mergeLocationObject($dataMasterStatus->getLocation(), $toBeDeletedStatus->getLocation())); $dataMasterStatus->setFromDate($this->mergeDateReference($dataMasterStatus->getFromDate(), $toBeDeletedStatus->getFromDate())); $dataMasterStatus->setToDate($this->mergeDateReference($dataMasterStatus->getToDate(), $toBeDeletedStatus->getToDate())); $dataMasterStatus->setProvenDate($this->mergeDateReference($dataMasterStatus->getProvenDate(), $toBeDeletedStatus->getProvenDate())); $dataMasterStatus->setComment($this->mergeStrings($dataMasterStatus->getComment(), $toBeDeletedStatus->getComment())); $toBeDeletedStatus->setFromDate(null); $toBeDeletedStatus->setProvenDate(null); $toBeDeletedStatus->setToDate(null); return $dataMasterStatus; }
public function matchingStatus(\UR\DB\NewBundle\Entity\Status $statusOne, \UR\DB\NewBundle\Entity\Status $statusTwo, $allowLessInformation = false) { $this->LOGGER->debug("Comparing " . $statusOne . " with " . $statusTwo); if (!$this->compareStrings($statusOne->getLabel(), $statusTwo->getLabel(), $allowLessInformation)) { return false; } if (!$this->compareCountries($statusOne->getCountry(), $statusTwo->getCountry(), $allowLessInformation)) { return false; } if (!$this->compareTerritories($statusOne->getTerritory(), $statusTwo->getTerritory(), $allowLessInformation)) { return false; } if (!$this->compareLocations($statusOne->getLocation(), $statusTwo->getLocation(), $allowLessInformation)) { return false; } if ($this->unmatchedArrays($statusOne->getFromDate(), $statusTwo->getFromDate(), "date", $allowLessInformation)) { return false; } if ($this->unmatchedArrays($statusOne->getToDate(), $statusTwo->getToDate(), "date", $allowLessInformation)) { return false; } if ($this->unmatchedArrays($statusOne->getProvenDate(), $statusTwo->getProvenDate(), "date", $allowLessInformation)) { return false; } return true; }