Beispiel #1
0
 private function mergeDateObjects(\UR\DB\NewBundle\Entity\Date $dataMasterDate, \UR\DB\NewBundle\Entity\Date $toBeDeletedDate)
 {
     //merge date!
     //and mind 0.0.1800 and similar dates!
     //if one date is "genauer" als the other, use it!
     //btw. ignore comments just merge them if necessary!
     $dataMasterDate->setDay($this->mergeStrings($dataMasterDate->getDay(), $toBeDeletedDate->getDay()));
     $dataMasterDate->setMonth($this->mergeStrings($dataMasterDate->getMonth(), $toBeDeletedDate->getMonth()));
     $dataMasterDate->setYear($this->mergeStrings($dataMasterDate->getYear(), $toBeDeletedDate->getYear()));
     $dataMasterDate->setWeekday($this->mergeStrings($dataMasterDate->getWeekday(), $toBeDeletedDate->getWeekday()));
     $dataMasterDate->setComment($this->mergeComment($dataMasterDate->getComment(), $toBeDeletedDate->getComment()));
     //@TODO: Before/ After booleans? They are not getting merged right now
     //remove toBeDeletedDate
     $this->getDBManager()->remove($toBeDeletedDate);
 }
Beispiel #2
0
 public function migrateDate($day, $month, $year, $weekday, $comment = null)
 {
     //insert into new data
     $newDate = new Date();
     $newDate->setDay($day);
     $newDate->setMonth($month);
     $newDate->setYear($year);
     $newDate->setWeekday($weekday);
     $newDate->setComment($this->normalize($comment));
     $this->getDBManager()->persist($newDate);
     $this->getDBManager()->flush();
     return $newDate->getId();
 }