Example #1
0
 public function scheduleCalculateMinRange($idSchedule)
 {
     $scheduleRangeDateService = new ScheduleRangeDateService();
     $scheduleRangeDateService->setManager($this->em);
     $scheduleRangeService = new ScheduleRangeService();
     $scheduleRangeService->setManager($this->em);
     $minRange = null;
     $scheduleRangeDates = $scheduleRangeDateService->getScheduleRangeDateByScheduleId($idSchedule);
     foreach ($scheduleRangeDates as $scheduleRangeDate) {
         $scheduleRanges = $scheduleRangeService->getScheduleRangeByScheduleRangeDate($scheduleRangeDate);
         foreach ($scheduleRanges as $scheduleRange) {
             if ($minRange == null) {
                 $minRange = $scheduleRange->getFromHour();
             } else {
                 if ($this->parseHour($scheduleRange->getFromHour()) < $this->parseHour($minRange)) {
                     $minRange = $scheduleRange->getFromHour();
                 }
             }
         }
     }
     return substr($minRange, 1);
 }
 public function testSaveScheduleRange()
 {
     $scheduleRangeService = new ScheduleRangeService();
     $scheduleRangeService->setManager($this->em);
     $params = array('toHour' => 'T12:00:00', 'fromHour' => 'T18:00:00');
     $scheduleRange = $scheduleRangeService->saveScheduleRange($this->scheduleRangeDate1, $params);
     $this->assertContains('T12:00:00', json_encode($scheduleRange));
     $this->assertContains('T18:00:00', json_encode($scheduleRange));
 }