Esempio n. 1
0
 /**
  * @Route("/initialize/{hotel}/{rateId}", name="booking_from_search", schemes={"https"}, defaults={"rateId"=null})
  * @Method("POST")
  */
 public function initializeFromSearchAction(Request $request, $hotel, $rateId = null)
 {
     $form = $this->createForm(new RateSearchType(), $rateSearchData = new RateSearchData());
     $form->submit($request);
     $bookingManager = $this->getBookingManager();
     $bookingUserSelection = $bookingManager->initializeBooking($hotel, $this->getRequest()->headers->get('referer'), true);
     $bookingUserSelection->setRateId($rateId);
     $bookingManager->initializeBookingFromSearch($bookingUserSelection, $rateSearchData->getDatePax());
     $bookingManager->saveBookingToSession($bookingUserSelection);
     return $this->redirect($this->generateUrl('booking_step_one', array('bookingId' => $bookingUserSelection->getBookingId())));
 }
Esempio n. 2
0
 /**
  * @Route("/initialize/{hotel}", name="hotel_from_search")
  * @Method("POST")
  */
 public function fromSearchAction(Request $request, $hotel)
 {
     $form = $this->createForm(new RateSearchType(), $rateSearchData = new RateSearchData());
     $form->submit($request);
     $searchData = $this->getSearchData();
     $searchData->datePax = $rateSearchData->getDatePax();
     $this->container->get('session')->set('search.data', $searchData);
     $hotelRepo = $this->getRepository('SehBundle:Hotel');
     $hotel = $hotelRepo->getValidQueryBuilder()->andWhere('h.reservitId = :id')->setParameter(':id', $hotel)->getQuery()->getOneOrNullResult();
     $rate = $this->getRepository('SehBundle:Reservit\\Rate')->find($rateSearchData->getRateId());
     return new RedirectResponse($this->get('seh.url_manager')->generateHotelUrl($hotel, null, true, $rate));
 }
Esempio n. 3
0
 /**
  * @param $slug
  * @param $rateId
  * @param $hotelId
  * @return \Symfony\Component\HttpFoundation\Response
  * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
  *
  * @Route("/search-form/{slug}/{rateId}/{hotelId}", name="seh_special_rate_search_form")
  * @Method("GET")
  */
 public function rateSearchFormAction($slug, $rateId = null, $hotelId = null)
 {
     /** @var QueryBuilder $queryBuilder */
     $queryBuilder = $this->getRepository('SehBundle:Reservit\\RateCategory')->createQueryBuilder('rc');
     $queryBuilder->where('rc.slug = :slug')->setParameter(':slug', $slug);
     $query = $queryBuilder->getQuery();
     $query->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, 'Gedmo\\Translatable\\Query\\TreeWalker\\TranslationWalker');
     try {
         /** @var RateCategory $rateCategory */
         $rateCategory = $query->getOneOrNullResult();
     } catch (\Exception $e) {
         throw new NotFoundHttpException();
     }
     $rateSearchData = new RateSearchData();
     $firstTime = true;
     /** @var FullSearchData $fullSearchData  */
     if ($fullSearchData = $this->get('session')->get('search.data')) {
         $rateSearchData->setDatePax(clone $fullSearchData->datePax);
         $rateSearchData->setAccentCard($fullSearchData->accentCard);
         $firstTime = false;
     } else {
         $rateSearchData->setDatePax(new DatePaxData());
     }
     $rateManager = $this->getSpecialRateManager();
     $rate = null;
     if ($rateId) {
         /** @var Rate $rate */
         $rate = $this->getRepository('SehBundle:Reservit\\Rate')->find($rateId);
         $rateDatePaxData = $rateManager->setupDatePaxData($rate, $rateSearchData->getDatePax());
         $rateSearchData->setDatePax($rateDatePaxData);
     }
     $form = $this->createForm(new RateSearchType(), $rateSearchData);
     return $this->render('SehBundle:form/rate:base.html.twig', array('form' => $form->createView(), 'rateCategory' => $rateCategory, 'rateId' => $rateId, 'rate' => $rate, 'hotelId' => $hotelId, 'minDate' => $rateSearchData->getDatePax()->minDate, 'startDate' => $rateSearchData->getDatePax()->startingDate, 'endDate' => $rateSearchData->getDatePax()->endingDate, 'firstTime' => $firstTime, 'global' => $this->getRequest()->get('global', false)));
 }