Exemplo n.º 1
0
 public function loadDateReferenceFromArray($em, $dateReference)
 {
     $this->LOGGER->debug("Loading DateReference.");
     if (count($dateReference) == 0) {
         return array();
     }
     $repository = $em->getRepository("NewBundle:Date");
     $objArray = [];
     for ($i = 0; $i < count($dateReference); $i++) {
         $this->LOGGER->debug("Loading: " . $dateReference[$i]);
         $dateReferenceOjb = null;
         if (DateRange::isDateRange($dateReference[$i])) {
             //date range found
             $dateReferenceOjb = DateRange::createDateRange($dateReference[$i], $repository);
         } else {
             $dateReferenceOjb = $repository->findOneById($dateReference[$i]);
         }
         $this->LOGGER->debug("Loading finished: " . $dateReferenceOjb);
         if (!is_null($dateReferenceOjb)) {
             $objArray[] = $dateReferenceOjb;
         }
     }
     $this->LOGGER->debug("Finished loading DateReference.");
     return $objArray;
 }
Exemplo n.º 2
0
 private function mergeDateRanges(\UR\DB\NewBundle\Utils\DateRange $dataMasterDateRange, \UR\DB\NewBundle\Utils\DateRange $toBeDeletedDateRange)
 {
     $dataMasterDateRange->setFrom($this->mergeDateObjects($dataMasterDateRange->getFrom(), $toBeDeletedDateRange->getFrom()));
     $dataMasterDateRange->setTo($this->mergeDateObjects($dataMasterDateRange->getTo(), $toBeDeletedDateRange->getTo()));
 }
Exemplo n.º 3
0
 public function matchingDateRanges(\UR\DB\NewBundle\Utils\DateRange $dateRangeOne, \UR\DB\NewBundle\Utils\DateRange $dateRangeTwo, $allowLessInformation = false)
 {
     $this->LOGGER->debug("Comparing '" . $dateRangeOne . "' with '" . $dateRangeTwo . "'");
     if ($this->matchingDates($dateRangeOne->getFrom(), $dateRangeTwo->getFrom(), $allowLessInformation)) {
         return false;
     }
     if ($this->matchingDates($dateRangeOne->getTo(), $dateRangeTwo->getTo(), $allowLessInformation)) {
         return false;
     }
     $this->LOGGER->debug("DateRanges are matching");
     return true;
 }