Beispiel #1
0
 /**
  * Add businessHoursException
  *
  * @param \Krombox\MainBundle\Entity\BusinessHoursException $businessHoursException
  * @return Place
  */
 public function addBusinessHoursException(\Krombox\MainBundle\Entity\BusinessHoursException $businessHoursException)
 {
     $this->businessHoursException[] = $businessHoursException;
     $businessHoursException->setPlace($this);
     return $this;
 }
 protected function divideBusinessHoursException($entity)
 {
     $today = new \DateTime();
     if ($entity->getStartsAt()->format('H:i:s') > $entity->getEndsAt()->format('H:i:s')) {
         $endsAt = $entity->getEndsAt();
         $entity->setEndsAt($today::createFromFormat('H:i:s', '23:59:59'));
         $nextDay = clone $entity->getDay();
         $nextDay->modify('+1 day');
         $bhE = new BusinessHoursException();
         $bhE->setDay($nextDay);
         $bhE->setPlace($entity->getPlace());
         $bhE->setStartsAt($today::createFromFormat('H:i:s', '00:00:00'));
         $bhE->setEndsAt($endsAt);
         $this->entities[] = $bhE;
     }
 }