src/Aviatur/SearchBundle/Controller/FlightController.php line 31

Open in your IDE?
  1. <?php
  2. namespace Aviatur\SearchBundle\Controller;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Doctrine\Persistence\ManagerRegistry;
  5. use Symfony\Component\HttpFoundation\Session\SessionInterface;
  6. use Aviatur\TwigBundle\Services\TwigFolder;
  7. use Aviatur\GeneralBundle\Services\AviaturChangeCoin;
  8. use Aviatur\FlightBundle\Services\SearchFlightCookie;
  9. use Symfony\Component\HttpFoundation\Request;
  10. class FlightController extends AbstractController {
  11.     public function indexAction(Request $requestManagerRegistry $registrySessionInterface $sessionAviaturChangeCoin $aviaturChangeCoinServiceSearchFlightCookie $searchFlightCookieTwigFolder $twigFolder) {
  12.         $em $registry->getManager();
  13.         $agencyId $session->get('agencyId');
  14.         $agency $em->getRepository(\Aviatur\AgencyBundle\Entity\Agency::class)->find($agencyId);
  15.         $validateChange $aviaturChangeCoinService->validateChangeCoin('flight');
  16.         $promoType '';
  17.         $promoTypeMain '-main';
  18.         $promoTypeRecommendations '-recommendations';
  19.         if($session->has('whitemark') === true){
  20.             $promoType '_' $session->get('whitemark');
  21.         }
  22.         $agenciesExcluded = ['Aviatur S.A.S.''Aviatur S.A.S. Metasearch''Aval''Aviacaribbean''Aviatur - WorldPay''Aviatur Carnaval BAQ MB''Aviatur Colombia''Aviatur Colombia EN''Aviatur Colombia ES''Aviatur Ecoturismo''Aviatur Kioskos''Aviatur Metasearch Mexico''Aviatur Mexico''Aviatur Mexico QA''Aviatur Mobile''Aviatur PinBus''Aviatur - Pruebas''BabyMarket''Buceo Colombia''Cielos Abiertos''Corona Aviatur''Directo a la Playa''Experiencias Jet-Set''Great Vibes''Landing visa''Lufthansa City Center''Megatours''Octopus Agents''Octopus Marcas Blancas''Octopus Travel QA''Panturismo Marcas Blancas''Parque Tayrona''Representaciones Pasabordo WM''Rokatur Marcas Blancas''RollingTrips''Star World''Swissandina''Takentours''TerraNet Marcas Blancas''Turiscol Ltda.''Aviatur S.A.''Union de Representaciones''Union de Representaciones - Whitemark''Virtuoso''Claro''WeCare''Octopus Travel Ltda.''Aviatur Site''Aviatur S.A.S. - BBVA''Aviatur Welcome Beds'];
  23.         $agencyPromoId 172;
  24.         $validationAgencyFolder false;
  25.         foreach ($agenciesExcluded as $agencyExcluded) {
  26.             if ($agencyExcluded === $agency->getName()) {
  27.                 $agencyPromoId $session->get('agencyId');
  28.                 $validationAgencyFolder true;
  29.             }
  30.         }
  31.         $homePromoList $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromoList::class)->findOneBy(['type' => '__vuelos'.$promoType'agency' => $agencyPromoId]);
  32.         if ($homePromoList != null) {
  33.             $homePromoTitle $homePromoList->getTitle();
  34.             $homePromoSubtitle $homePromoList->getSubtitle();
  35.             $homePromos $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromo::class)->findByHomePromoList($homePromoList, ['date' => 'DESC']);
  36.         } else {
  37.             $homePromoTitle null;
  38.             $homePromoSubtitle null;
  39.             $homePromos = [];
  40.         }
  41.         $homePromoListMain $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromoList::class)->findOneBy(["type" => '__vuelos'.$promoTypeMain"agency" => $agencyPromoId]);
  42.         if ($homePromoListMain != null) {
  43.             $homePromoMainTitle $homePromoListMain->getTitle();
  44.             $homePromoMainSubtitle $homePromoListMain->getSubtitle();
  45.             $homePromosMain $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromo::class)->findByHomePromoList($homePromoListMain, ['date' => 'DESC']);
  46.         } else {
  47.             $homePromoMainTitle null;
  48.             $homePromoMainSubtitle null;
  49.             $homePromosMain = [];
  50.         }
  51.         $homePromoListRecommendations $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromoList::class)->findOneBy(["type" => '__vuelos'.$promoTypeRecommendations"agency" => $agencyPromoId]);
  52.         if ($homePromoListRecommendations != null) {
  53.             $homePromoRecommendationsTitle $homePromoListRecommendations->getTitle();
  54.             $homePromoRecommendationsSubtitle $homePromoListRecommendations->getSubtitle();
  55.             $homePromosRecommendations $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromo::class)->findByHomePromoList($homePromoListRecommendations, ['date' => 'DESC']);
  56.         } else {
  57.             $homePromoRecommendationsTitle null;
  58.             $homePromoRecommendationsSubtitle null;
  59.             $homePromosRecommendations = [];
  60.         }
  61.         $configsFlightCalendarAgency $em->getRepository(\Aviatur\FlightBundle\Entity\ConfigFlightCalendarAgency::class)->findProviderForFlightsWithAgency($agency);
  62.         $providerInfo true;
  63.         $providers = [];
  64.         foreach ($configsFlightCalendarAgency as $configFlightCalendarAgency) {
  65.             $provider $configFlightCalendarAgency->getProvider()->getProvideridentifier();
  66.             if (!in_array($provider$providers)) {
  67.                 $providers[] = $provider;
  68.             }
  69.         }
  70.         $providerIds implode(';'$providers);
  71.         if(empty($providerIds)){
  72.             $providerInfo false;
  73.         }
  74.         $aviaturSearchExplore $em->getRepository(\Aviatur\GeneralBundle\Entity\Parameter::class)->findOneBy(['name' => 'aviatur_search_explore''value' => 1]);
  75.         $isFront $session->has('operatorId');
  76.         $pixelInfo = [];
  77.         $parameters json_decode($session->get($request->getHost() . '[parameters]'));
  78.         $currentDate date("Y-m-d");
  79.         $endDateCensocud $parameters->date_end_cencosud;
  80.         $activeCheckCencosud = (strtotime($endDateCensocud) >= strtotime($currentDate));
  81.         $validateExplore = !($aviaturSearchExplore === null);
  82.         $cookieLastSearch $searchFlightCookie->searchFlightCookie();
  83.         $agencyFolder $twigFolder->twigFlux();
  84.         return $this->render($twigFolder->twigExists('@AviaturTwig/' $agencyFolder '/Search/Flight/flightSearch_index.html.twig'), ['validateExplore' => $validateExplore'pixel_info' => $pixelInfo'providerInfo' => $providerInfo'cookieLastSearch' => $cookieLastSearch'homePromos' => $homePromos'titlePromo' => $homePromoTitle'subtitlePromo' => $homePromoSubtitle'promoType' => '__vuelos''homePromosMain' => $homePromosMain'titlePromoMain' => $homePromoMainTitle'subtitlePromoMain' => $homePromoMainSubtitle'promoTypeMain' => '__vuelos'.$promoTypeMain'homePromosRecommendations' => $homePromosRecommendations'titlePromoRecommendations' => $homePromoRecommendationsTitle'subtitlePromoRecommendations' => $homePromoRecommendationsSubtitle'promoTypeRecommendations' => '__vuelos'.$promoTypeRecommendations'activeCheckCencosud' => $activeCheckCencosud'validationAgencyFolder' => $validationAgencyFolder]);
  85.     }
  86. }