vendor/elements/demi-bundle/src/Elements/Demi/Accommodation/Search/Parameter.php line 33

Open in your IDE?
  1. <?php
  2. /**
  3.  * Elements DeMI
  4.  *
  5.  * This source file is available under the elements DeMI license version 1
  6.  *
  7.  *  @copyright  Copyright (c) elements.at New Media Solutions GmbH (https://www.elements.at/)
  8.  *  @license    elements DeMI Lizenz Version 1 (https://www.elements.at/de/demi-lizenz)
  9.  */
  10. namespace Elements\Demi\Accommodation\Search;
  11. use Carbon\Carbon;
  12. use DateTime;
  13. use Elements\Demi\Dependency\DependencyContainer;
  14. use Elements\Demi\Deskline\SearchParameter\AccommodationInterface;
  15. use Elements\Demi\Helper;
  16. use Elements\Demi\Model\AccommodationProduct;
  17. use Elements\Demi\Model\AccommodationService;
  18. use Elements\Demi\Model\AccommodationServiceProvider;
  19. use Elements\Demi\Model\FacilityGroup;
  20. use Elements\Demi\Model\MarketingGroup;
  21. use Elements\Demi\Model\MealType;
  22. use Elements\Demi\Model\Region;
  23. use Elements\Demi\Model\SalesChannel;
  24. use Elements\Demi\Model\Town;
  25. use JetBrains\PhpStorm\Pure;
  26. use Pimcore\Db;
  27. use Pimcore\Model\DataObject\AbstractObject;
  28. use Pimcore\Model\DataObject\DemiSystemObject;
  29. class Parameter extends AbstractParameter
  30. {
  31.     public const SORT_ORDER_RANDOM 'Random';
  32.     public const SORT_ORDER_PRICE_ASC 'TotalPrice';
  33.     public const SORT_ORDER_PRICE_DESC 'TotalPriceDesc';
  34.     public const SORT_ORDER_BASEPRICE_ASC 'Price';
  35.     public const SORT_ORDER_BASEPRICE_DESC 'BasePriceDesc';
  36.     public const SORT_ORDER_STARS_ASC 'StarsAsc';
  37.     public const SORT_ORDER_STARS_DESC 'StarsDesc';
  38.     public const SORT_ORDER_BOOKABLE_ASC 'Bookable';
  39.     public const SORT_ORDER_BOOKABLE_DESC 'BookableDesc';
  40.     public const SORT_ORDER_RATING_ASC 'Rating';
  41.     public const SORT_ORDER_RATING_DESC 'RatingDesc';
  42.     public const SORT_ORDER_TOWN_ASC 'Town';
  43.     public const SORT_ORDER_TOWN_DESC 'TownDesc';
  44.     public const SORT_ORDER_NAME_ASC 'Name';
  45.     public const SORT_ORDER_NAME_DESC 'NameDesc';
  46.     public const SORT_ORDER_PRIORITY_ASC 'priorityAsc';
  47.     public const SORT_ORDER_PRIORITY_DESC 'priority';
  48.     public const SORT_ORDER_RATING_AVERAGE_DESC 'ratingAverageDesc';
  49.     public const SORT_ORDER_RATING_AVERAGE_ASC 'ratingAverageAsc';
  50.     public const DEMI_SORT_ORDER_RANDOM 'random';
  51.     public const DEMI_SORT_ORDER_PRICE_ASC 'priceAsc';
  52.     public const DEMI_SORT_ORDER_PRICE_DESC 'priceDesc';
  53.     public const DEMI_SORT_ORDER_STARS_ASC 'starsAsc';
  54.     public const DEMI_SORT_ORDER_STARS_DESC 'starsDesc';
  55.     public const DEMI_SORT_ORDER_RATING_ASC 'rating';
  56.     public const DEMI_SORT_ORDER_RATINGAVERAGE_ASC 'ratingAverageAsc';
  57.     public const DEMI_SORT_ORDER_RATINGAVERAGE_DESC 'ratingAverageDesc';
  58.     public const DEMI_SORT_ORDER_RATING_DESC 'ratingDesc';
  59.     public const DEMI_SORT_ORDER_BOOKABLE_ASC 'bookable';
  60.     public const DEMI_SORT_ORDER_CONTENTSCORE 'contentScore';
  61.     public const SEARCH_TYPE_ONE_PRODUCT_PER_HOTEL 'OneProductPerHotel';
  62.     public const SEARCH_TYPE_STANDARD 'Standard';
  63.     public const SEARCH_TYPE_EACH_PRODUCT_SEPARATED 'EachProductSeparated';
  64.     public const SEARCH_TYPE_ONE_PRODUCT_PER_PACKAGE 'OneProductPerPackage';
  65.     public const PRODUCT_TYPE_ACCOMMODATION 'Accommodation';
  66.     public const PRODUCT_TYPE_ADDITIONAL_SERVICE 'AdditionalService';
  67.     public const PRODUCT_TYPE_PACKAGE 'Package';
  68.     public const RESPONSE_TYPE_EXPANDED 'Expanded';
  69.     public const RESPONSE_TYPE_STANDARD 'Standard';
  70.     public const SPECIAL_TYPE_LASTMINUTE 'LastMinute';
  71.     public const SPECIAL_TYPE_EARLYBOOKER 'EarlyBooker';
  72.     public const SPECIAL_TYPE_SPLIT 'split';
  73.     protected bool $bookOnRequestAsBookable false;
  74.     protected array $refilterCustomOrder = [];
  75.     protected string $language '';
  76.     protected int $priority 0;
  77.     protected string $priorityOperator 'greaterThan';
  78.     protected bool $useMultiLineMerge false;
  79.     protected bool $daccoRelTableNeeded false;
  80.     protected bool $serviceTableNeeded false;
  81.     protected bool $serviceRelTableNeeded false;
  82.     protected bool $productTableNeeded false;
  83.     protected bool $starsTableNeeded false;
  84.     protected bool $skipCleaningSortAfterFactory false;
  85.     protected bool $skipBaseFilter false;
  86.     protected bool $unpublished false;
  87.     protected bool $isCorridor false;
  88.     protected bool $isAlternative false;
  89.     protected int $previousResults 0;
  90.     /** feratel specific parameters */
  91.     protected ?string $mealCode null;
  92.     protected ?array $order null;
  93.     protected ?string $searchType null;
  94.     protected ?array $excludeAccoIds null;
  95.     protected ?array $accoFIds null;
  96.     protected ?Carbon $dateTo null;
  97.     protected array $towns = [];
  98.     protected array $regions = [];
  99.     protected int $period 0;
  100.     protected array $nights = [];
  101.     protected string $responseType \Elements\Demi\Deskline\Constant\SearchParameter\AccommodationInterface::RESPONSE_TYPE_EXPANDED;
  102.     protected int $minPrice 0;
  103.     protected float $priceFrom 0.0;
  104.     protected float $priceTo 0.0;
  105.     protected float $priceRangeFrom 0.0;
  106.     protected float $priceRangeTo 0.0;
  107.     protected array $roomrows = [];
  108.     protected array $districts = [];
  109.     protected array $stars = [];
  110.     protected array $hotelChains = [];
  111.     protected array $classifications = [];
  112.     protected string $classificationOperator 'OR';
  113.     protected string $classificationStarsOperator 'OR';
  114.     protected array $marketingGroups = [];
  115.     protected string $marketingGroupOperator 'OR';
  116.     protected array $holidayThemes = [];
  117.     protected string $holidayThemesOperator 'OR';
  118.     protected array $facilities = [];
  119.     protected array $roomFacilities = [];
  120.     protected array $apartmentFacilities = [];
  121.     protected string $facilityOperator 'AND';
  122.     protected array $facilityCombinations = [];
  123.     protected string $facilityCombinationOperator 'AND';
  124.     protected ?string $fullText null//TODO not yet supported
  125.     protected ?bool $topOnly null;
  126.     protected ?int $topFirst null;
  127.     protected bool $allTopsFirst false;
  128.     protected ?bool $bookOnly null;
  129.     protected ?bool $notBookOnly null;
  130.     protected ?bool $ticketingOnly null;
  131.     //specials and bestprice
  132.     protected string $specialsOperator 'OR';
  133.     protected mixed $specialsOnly false;
  134.     protected array $specialSpecific = [];
  135.     protected array $excludeSpecialSpecific = [];
  136.     protected bool $bestpriceOnly false;
  137.     protected mixed $bestpriceProvider false;
  138.     protected array $accommodationType = [];
  139.     protected array $serviceCode = [];
  140.     protected ?string $productType null;
  141.     protected mixed $productId 0;
  142.     protected ?array $productIds null;
  143.     protected ?string $lastAvailabilitiyChangeDays null;
  144.     protected ?int $minAmountSleepingRooms null;
  145.     protected int|float $minPriceBound 1;
  146.     protected int $orderRandSeed 0;
  147.     protected int $minRatingCountForSort 1;
  148.     protected ?int $currentItemCountPerPage 1;
  149.     protected bool $calculateStandardPrice true;
  150.     protected bool $extendedResultset false;
  151.     protected bool $checkTestHotels false;
  152.     protected array $ignoreFiltersInAccoDetailSearch = [
  153.         'freeCancellation',
  154.         'minAmountSleepingRooms',
  155.         'priceFrom',
  156.         'priceTo',
  157.         'serviceCode',
  158.         'roomFacilities',
  159.         'stars',
  160.         'classificationIds',
  161.     ];
  162.     protected bool $freeCancellation false;
  163.     protected int $contentScore 0;
  164.     protected ?int $currentPage 1;
  165.     public function __construct()
  166.     {
  167.     }
  168.     public function setMarketingGroupOperator(string $marketingGroupOperator): void
  169.     {
  170.         $this->marketingGroupOperator $marketingGroupOperator;
  171.     }
  172.     public function getMarketingGroupOperator(): string
  173.     {
  174.         return $this->marketingGroupOperator;
  175.     }
  176.     public function getIgnoreFiltersInAccoDetailSearch(): array
  177.     {
  178.         return $this->ignoreFiltersInAccoDetailSearch;
  179.     }
  180.     #[Pure]
  181.     public function getSortOrder(): array|string|null
  182.     {
  183.         return $this->getOrder();
  184.     }
  185.     public function isSkipCleaningSortAfterFactory(): bool
  186.     {
  187.         return $this->skipCleaningSortAfterFactory;
  188.     }
  189.     public function setSkipCleaningSortAfterFactory(bool $skipCleaningSortAfterFactory): void
  190.     {
  191.         $this->skipCleaningSortAfterFactory $skipCleaningSortAfterFactory;
  192.     }
  193.     public function setPage($currentPage): Parameter
  194.     {
  195.         $this->setCurrentPage($currentPage);
  196.         return $this;
  197.     }
  198.     #[Pure]
  199.     public function getPerPage(): int
  200.     {
  201.         return $this->getCurrentItemCountPerPage();
  202.     }
  203.     public function setPerPage(int $currentItemCountPerPage): Parameter
  204.     {
  205.         $this->setCurrentItemCountPerPage($currentItemCountPerPage);
  206.         return $this;
  207.     }
  208.     public function setCurrentItemCountPerPage(?int $currentItemCountPerPage): self
  209.     {
  210.         $this->currentItemCountPerPage $currentItemCountPerPage;
  211.         return $this;
  212.     }
  213.     public function getCurrentItemCountPerPage(): int
  214.     {
  215.         return $this->currentItemCountPerPage;
  216.     }
  217.     public function setCurrentPage(?int $currentPage): Parameter
  218.     {
  219.         $this->currentPage $currentPage;
  220.         return $this;
  221.     }
  222.     public function getCurrentPage(): int
  223.     {
  224.         return $this->currentPage;
  225.     }
  226.     public function getTownsForParent($parent): array
  227.     {
  228.         $towns = [];
  229.         if ($parent) {
  230.             $childs $parent->getChildren();
  231.             foreach ($childs as $child) {
  232.                 if ($child instanceof Town) {
  233.                     $towns[] = $child->getId();
  234.                 } elseif ($child instanceof Region) {
  235.                     array_merge($towns$this->getTownsForParent($child));
  236.                 }
  237.             }
  238.         }
  239.         return $towns;
  240.     }
  241.     public function getQueryCondition(DependencyContainer $dcstring $accoTable 'dacco'string $serviceTable 'services'string $productTable 'products'): string
  242.     {
  243.         $condition = [];
  244.         if (!$this->getUnpublished()) {
  245.             $condition[] = ' ' $accoTable '.o_published = 1 ';
  246.         }
  247.         if ($this->getClientKey()) {
  248.             /** @var \Pimcore\Model\DataObject\DemiSystemObject\Listing $systemObjects */
  249.             $systemObjects DemiSystemObject::getByClientKey($this->getClientKey());
  250.             $condition[] = 'dacco.systemObject__id in ( ' implode(','array_map(
  251.                 static function (DemiSystemObject $systemObject) {
  252.                     return $systemObject->getId();
  253.                 },
  254.                 $systemObjects->getObjects()
  255.             )) . ') ';
  256.         }
  257.         if (!empty($this->accoId)) { //for detail page
  258.             $ids = [];
  259.             foreach ((array)$this->accoIds as $accoId) {
  260.                 $ids[] = (int)$accoId;
  261.             }
  262.             $condition[] = ' oo_id IN (' implode(', '$ids) . ') ';
  263.         }
  264.         if (!empty($this->productType)) {
  265.             $condition[] = '(' $productTable '.o_published = 1 ' ' AND ' $productTable '.productType = ' Db::get()->quote($this->productType) . ')';
  266.         }
  267.         if (!empty($this->accommodationType)) {
  268.             //\Pimcore\Db::get()->quote()
  269.             $tmpTypes = [];
  270.             foreach ($this->accommodationType as $accoType) {
  271.                 $tmpTypes[] = Db::get()->quote($accoType);
  272.             }
  273.             $condition[] = '(' $productTable '.accommodationType IN (' implode(', '$tmpTypes) . '))';
  274.         }
  275.         if (!empty($this->districts)) {
  276.             $tmpConditions = [];
  277.             foreach ($this->districts as $district) {
  278.                 if (is_numeric($district)) {
  279.                     $tmpConditions[] = $accoTable '.district__id = ' . (int)$district;
  280.                 }
  281.             }
  282.             $condition[] = '(' implode(' OR '$tmpConditions) . ')';
  283.         }
  284.         $tmpTowns = [];
  285.         if (!empty($this->regions)) {
  286.             //$tmpConditionsRegions = array();
  287.             foreach ($this->regions as $region) {
  288.                 if (!is_object($region) && is_numeric($region)) {
  289.                     $region \Elements\Demi\AbstractObject::getById($region);
  290.                 }
  291.                 $childs $this->getTownsForParent($region);
  292.                 foreach ($childs as $town) {
  293.                     $tmpTowns[] = $town;
  294.                 }
  295.             }
  296.         }
  297.         if (!empty($this->towns)) {
  298.             foreach ($this->towns as $town) {
  299.                 if (is_numeric($town)) {
  300.                     $tmpTowns[] = (int)$town;
  301.                 }
  302.             }
  303.         }
  304.         if (!empty($tmpTowns)) {
  305.             $areaCondition[] = $accoTable '.town__id IN (' implode(', '$tmpTowns) . ')';
  306.         }
  307.         if (!empty($areaCondition)) {
  308.             $condition[] = '(' implode(' OR '$areaCondition) . ')';
  309.         }
  310.         if (!empty($this->name)) {
  311.             $tmpCond $accoTable '.name LIKE ' Db::get()->quote('%' $this->name '%');
  312.             if (!empty($this->getLanguage())) {
  313.                 $tmpCond .= ' OR localized.nameLocalized LIKE ' Db::get()->quote('%' $this->name '%');
  314.             }
  315.             $condition[] = ' (' $tmpCond ') ';
  316.         }
  317.         $starcondition = [];
  318.         if (!empty($this->stars)) {
  319.             $tmpConditions = [];
  320.             foreach ($this->stars as $star) {
  321.                 $tmpConditions[] = $accoTable '.stars__id = ' . (int)$star;
  322.             }
  323.             $starcondition[] = '(' implode(' OR '$tmpConditions) . ')';
  324.         }
  325.         if (!empty($this->classifications)) {
  326.             $tmpConditions = [];
  327.             foreach ($this->classifications as $classification) {
  328.                 $tmpConditions[] = $accoTable ".classifications LIKE '%," . (int)$classification ",%'";
  329.             }
  330.             $starcondition[] = '(' implode(' ' $this->classificationOperator ' '$tmpConditions) . ')';
  331.         }
  332.         if (!empty($starcondition)) {
  333.             $condition[] = '(' implode(' OR '$starcondition) . ')';
  334.         }
  335.         if (!empty($this->hotelChains)) {
  336.             $tmpConditions = [];
  337.             foreach ($this->hotelChains as $hotelChain) {
  338.                 $tmpConditions[] = $accoTable '.hotelChain__id = ' . (int)$hotelChain;
  339.             }
  340.             $condition[] = '(' implode(' OR '$tmpConditions) . ')';
  341.         }
  342.         if (!empty($this->priority)) {
  343.             if ($this->getPriorityOperator() === 'greaterThan') {
  344.                 $condition[] = $this->priority ' <= ' $accoTable '.priority';
  345.             } elseif ($this->getPriorityOperator() === 'smallerThan') {
  346.                 $condition[] = $this->priority ' > ' $accoTable '.priority';
  347.             }
  348.         }
  349.         $dummyProduct = new AccommodationProduct();
  350.         $dummyService = new AccommodationService();
  351.         if ($this->salesChannelId) {
  352.             $condition[] = "$this->salesChannelId in (SELECT dest_id
  353.                FROM {$dc->getUsedPimcoreDb()}.object_relations_{$dummyProduct->getClassId()} salesprodrel
  354.                INNER JOIN {$dc->getUsedPimcoreDb()}.object_{$dummyProduct->getClassId()} salesprod ON salesprodrel.src_id = salesprod.oo_id
  355.                INNER JOIN {$dc->getUsedPimcoreDb()}.object_{$dummyService->getClassId()} salesservice ON salesprod.o_parentId = salesservice.oo_id
  356.               WHERE fieldname = 'salesChannels'
  357.               AND salesservice.o_parentId = dacco.oo_id
  358.               )";
  359.         }
  360.         $dummyAcco = new \Elements\Demi\Model\AccommodationServiceProvider();
  361.         if (!empty($this->categories)) {
  362.             $tmpCats = [];
  363.             foreach ($this->categories as $category) {
  364.                 $tmpCats[] = intval($category);
  365.             }
  366.             $condition[] = 'EXISTS (
  367.               SELECT 1 FROM
  368.                 ' $dc->getUsedPimcoreDb() . '.object_relations_' $dummyAcco->getClassId() . ' subfacrel
  369.               WHERE subfacrel.src_id = dacco.o_id AND subfacrel.dest_id IN (' implode(','$tmpCats) . ") AND subfacrel.fieldname = 'categories'
  370.             )";
  371.         }
  372.         if (!empty($this->facilities)) {
  373.             foreach ($this->facilities as $facility) {
  374.                 $dummyObj AbstractObject::getById($facility);
  375.                 if ($dummyObj instanceof FacilityGroup) {
  376.                     foreach ($dummyObj->getChildren() as $facilityChild) {
  377.                         $facIds[] = $facilityChild->getId();
  378.                     }
  379.                 } else {
  380.                     $facIds[] = (int)$facility;
  381.                 }
  382.             }
  383.             $facilityMatchCount count($facIds ?? []);
  384.             if ($this->getFacilityOperator() === 'OR') {
  385.                 $facilityMatchCount 1;
  386.             }
  387.             $condition[] = '(
  388.               SELECT count(*) FROM
  389.                 ' $dc->getUsedPimcoreDb() . '.object_relations_' AccommodationServiceProvider::classId() . ' subfacrel
  390.               WHERE subfacrel.src_id = dacco.o_id AND subfacrel.dest_id IN (' implode(','$facIds ?? []) . ") AND subfacrel.fieldname = 'facility'
  391.             ) = " $facilityMatchCount;
  392.         }
  393.         if (!empty($this->roomFacilities) || !empty($this->apartmentFacilities)) {
  394.             $facIds = [];
  395.             $unitFacilities array_unique(array_merge($this->roomFacilities$this->apartmentFacilities));
  396.             foreach ($unitFacilities as $facility) {
  397.                 $dummyObj AbstractObject::getById($facility);
  398.                 if ($dummyObj instanceof FacilityGroup) {
  399.                     foreach ($dummyObj->getChildren() as $facilityChild) {
  400.                         $facIds[] = $facilityChild->getId();
  401.                     }
  402.                 } else {
  403.                     $facIds[] = (int)$facility;
  404.                 }
  405.             }
  406.             $facilityMatchCount count($facIds);
  407.             if ($this->getFacilityOperator() === 'OR') {
  408.                 $facilityMatchCount 1;
  409.             }
  410.             $serviceIdCondition '';
  411.             $condition[] = '(
  412.               SELECT count(*) FROM
  413.                 ' $dc->getUsedPimcoreDb() . '.object_relations_' $dummyService->getClassId() . ' servicefacrel
  414.               WHERE ' $serviceIdCondition ' servicefacrel.src_id = services.oo_id AND servicefacrel.dest_id IN (' implode(','$facIds) . ") AND servicefacrel.fieldname = 'facility' AND services.o_published = 1
  415.             ) = " $facilityMatchCount;
  416.         }
  417.         if (!empty($this->facilityCombinations)) {
  418.             $tmpConditions = [];
  419.             foreach ($this->facilityCombinations as $facilityArray) {
  420.                 $accoIds = [];
  421.                 $mgIds = [];
  422.                 $facIds = [];
  423.                 foreach ($facilityArray as $facility) {
  424.                     $dummyObj AbstractObject::getById($facility);
  425.                     if ($dummyObj instanceof FacilityGroup) {
  426.                         foreach ($dummyObj->getChildren() as $facilityChild) {
  427.                             $facIds[] = $facilityChild->getId();
  428.                         }
  429.                     } elseif ($dummyObj instanceof AccommodationServiceProvider) {
  430.                         $accoIds[] = $dummyObj->getId();
  431.                     } elseif ($dummyObj instanceof MarketingGroup) {
  432.                         $mgIds[] = $dummyObj->getId();
  433.                     } else {
  434.                         $facIds[] = (int)$facility;
  435.                     }
  436.                 }
  437.                 $facilityMatchCount 1;
  438.                 $tmptmpConditions = [];
  439.                 if (!empty($facIds)) {
  440.                     $tmptmpConditions[] = '((
  441.                       SELECT count(*) FROM
  442.                         ' $dc->getUsedPimcoreDb() . '.object_relations_' AccommodationServiceProvider::classId() . ' subfacrel
  443.                       WHERE subfacrel.src_id = dacco.o_id AND subfacrel.dest_id IN (' implode(','$facIds) . ") AND subfacrel.fieldname = 'facility'
  444.                     ) = " $facilityMatchCount ')';
  445.                 }
  446.                 if (!empty($mgIds)) {
  447.                     $tmptmpConditions[] = '((
  448.                       SELECT count(*) FROM
  449.                         ' $dc->getUsedPimcoreDb() . '.object_relations_' AccommodationServiceProvider::classId() . ' subfacrelmg
  450.                       WHERE subfacrelmg.src_id = dacco.o_id AND subfacrelmg.dest_id IN (' implode(','$mgIds) . ") AND subfacrelmg.fieldname = 'marketingGroups'
  451.                     ) = " $facilityMatchCount ')';
  452.                 }
  453.                 if (!empty($accoIds)) {
  454.                     $tmptmpConditions[] .= '(dacco.oo_id IN (' implode(', '$accoIds) . '))';
  455.                 }
  456.                 $tmpCondition '(' implode(' OR '$tmptmpConditions) . ')';
  457.                 $tmpConditions[] = $tmpCondition;
  458.             }
  459.             $condition[] = ' (' implode(' ' $this->getFacilityCombinationOperator() . ' '$tmpConditions) . ') ';
  460.         }
  461.         if (!empty($this->marketingGroups)) {
  462.             $tmpConditions = [];
  463.             if (is_array(current($this->marketingGroups))) { //is mg Collection
  464.                 $collectionOperator 'AND';
  465.                 if ($this->marketingGroupOperator === 'AND') {
  466.                     $collectionOperator 'OR';
  467.                 }
  468.                 foreach ($this->marketingGroups as $marketingGroupCollection) {
  469.                     $mgCollCondition = [];
  470.                     foreach ($marketingGroupCollection as $marketingGroup) {
  471.                         $mgCollCondition[] = $accoTable ".marketingGroups LIKE '%," . (int)$marketingGroup ",%'";
  472.                     }
  473.                     $tmpConditions[] = '(' implode(' ' $this->marketingGroupOperator ' '$mgCollCondition) . ')';
  474.                 }
  475.                 $condition[] = '(' implode(' ' $collectionOperator ' '$tmpConditions) . ')';
  476.             } else {
  477.                 foreach ($this->marketingGroups as $marketingGroup) {
  478.                     $tmpConditions[] = $accoTable ".marketingGroups LIKE '%," . (int)$marketingGroup ",%'";
  479.                 }
  480.                 $condition[] = '(' implode(' ' $this->marketingGroupOperator ' '$tmpConditions) . ')';
  481.             }
  482.         }
  483.         $holidayThemes $this->getHolidayThemes();
  484.         if (!empty($holidayThemes)) {
  485.             $tmpConditions = [];
  486.             foreach ($holidayThemes as $holidayTheme) {
  487.                 $tmpConditions[] = $productTable ".holidayThemes LIKE '%," . (int)$holidayTheme ",%'";
  488.             }
  489.             $condition[] = '(' implode(' ' $this->getHolidayThemesOperator() . ' '$tmpConditions) . ')';
  490.         }
  491.         if ($this->topOnly) {
  492.             $condition[] = $accoTable '.isTop = 1';
  493.         }
  494.         //check acco bookable (for nodate search)
  495.         if ($this->bookOnly) {
  496.             $condition[] = $accoTable '.bookable = 1';
  497.         } elseif ($this->notBookOnly) {
  498.             if (!$this->dateFrom || !$this->dateTo) {
  499.                 $condition[] = $accoTable '.bookable = 0';
  500.             }
  501.         }
  502.         //bookonly check is done in resultbuilder
  503.         if ($this->isTicketingOnly()) {
  504.             $condition[] = $accoTable '.allowTicketing = 1';
  505.         }
  506.         if ($this->bestpriceProvider) {
  507.             $condition[] = $accoTable '.bestPrice = 1';
  508.         }
  509.         if (is_int($this->minAmountSleepingRooms) || $this->minAmountSleepingRooms 0) {
  510.             $condition[] = "$serviceTable.bedrooms >= $this->minAmountSleepingRooms";
  511.         }
  512.         if ($this->serviceCode) {
  513.             $serviceCodeCondition = [];
  514.             foreach ($this->serviceCode as $serviceCode) {
  515.                 $serviceCodeCondition[] = "$serviceTable.code LIKE " Db::get()->quote('%' strtoupper($serviceCode) . '%');
  516.             }
  517.             $condition[] = '( ' implode(' OR '$serviceCodeCondition) . ' )';
  518.         }
  519.         if ($this->isNoDate() && $this->getProductType() === 'Package') {
  520.             $today = new DateTime();
  521.             $condition[] = '(
  522.                 ' $productTable '.oo_id  IN (SELECT DISTINCT o_id FROM ' $dc->getUsedPimcoreDb() . '.object_collection_demiDate_' $dummyProduct->getClassId() . '
  523.                 WHERE  `to` > ' $today->getTimestamp() . ") OR validDatesType = 'Always'
  524.             )";
  525.         }
  526.         if ($this->getCheckTestHotels()) {
  527.             $condition[] = '(' $accoTable '.isTesthotel = 0 OR isTesthotel IS NULL)';
  528.         }
  529.         return implode(' AND '$condition);
  530.     }
  531.     public function setDateTo(?Carbon $dateTo): self
  532.     {
  533.         $this->dateTo Helper::dateTimeClearTime($dateTo);
  534.         return $this;
  535.     }
  536.     public function getDateTo(): ?Carbon
  537.     {
  538.         return $this->dateTo;
  539.     }
  540.     public function setPeriod($period): Parameter
  541.     {
  542.         $this->period $period;
  543.         return $this;
  544.     }
  545.     public function getPeriod(): int
  546.     {
  547.         return $this->period;
  548.     }
  549.     public function setRegions($regionId): Parameter
  550.     {
  551.         $this->regions $regionId;
  552.         return $this;
  553.     }
  554.     public function getRegions(): array
  555.     {
  556.         return $this->regions;
  557.     }
  558.     public function setTowns($townId): Parameter
  559.     {
  560.         $this->towns $townId;
  561.         return $this;
  562.     }
  563.     public function getTowns(): array
  564.     {
  565.         return $this->towns;
  566.     }
  567.     public function validateRequiredVacancySearchParameter(): bool
  568.     {
  569.         $requiredFields $this->getRequiredFields();
  570.         $missingFields = [];
  571.         foreach ($requiredFields as $field) {
  572.             $value $this->{'get' ucfirst($field)}();
  573.             if (empty($value)) {
  574.                 $missingFields[] = $field;
  575.             }
  576.         }
  577.         $roomConfig $this->getRoomrows();
  578.         if (count($roomConfig) <= 0) {
  579.             $missingFields[] = 'rooms';
  580.         } else {
  581.             $firstRow $roomConfig[0];
  582.             if (empty($firstRow->getBeds())) {
  583.                 $missingFields[] = 'beds';
  584.             }
  585.         }
  586.         if (!empty($missingFields)) {
  587.             return false;
  588.         }
  589.         return true;
  590.     }
  591.     protected function getRequiredFields(): array
  592.     {
  593.         return [
  594.             'dateFrom',
  595.             'dateTo',
  596.             'period',
  597.             'roomrows',
  598.             //"beds"
  599.         ];
  600.     }
  601.     public function setRoomrows(array $roomrows): Parameter
  602.     {
  603.         $this->roomrows $roomrows;
  604.         return $this;
  605.     }
  606.     public function getRoomrows(): array
  607.     {
  608.         return $this->roomrows;
  609.     }
  610.     public function getDaysUntilArrival(): int|string
  611.     {
  612.         if ($this->getDateFrom()) {
  613.             return $this->getDateFrom()->diff(new DateTime())->format('%a');
  614.         }
  615.         return 0;
  616.     }
  617.     public function getCompleteCacheHash(?int $page null, ?int $pagesize null): string
  618.     {
  619.         $string serialize($this) . ':' $page ':' $pagesize//needed for live search
  620.         return md5($string);
  621.     }
  622.     public function getVacancyCacheHash(): string
  623.     {
  624.         $roomRowString '';
  625.         foreach ($this->getRoomrows() as $row) {
  626.             $roomRowString .= $row->getVacancyCacheString();
  627.         }
  628.         if ($this->dateFrom && $this->dateTo) {
  629.             return md5($this->dateFrom->format('YMD') . ',' .
  630.                 $this->dateTo->format('YMD') . ',' .
  631.                 $this->getPeriod() . ',' .
  632.                 $roomRowString);
  633.         }
  634.         return md5($roomRowString);
  635.     }
  636.     public function addRoomRow($row): Parameter
  637.     {
  638.         $this->roomrows[] = $row;
  639.         return $this;
  640.     }
  641.     public function setBookOnly(bool $bookOnly): self
  642.     {
  643.         $this->bookOnly $bookOnly;
  644.         return $this;
  645.     }
  646.     public function getBookOnly(): ?bool
  647.     {
  648.         return $this->bookOnly;
  649.     }
  650.     public function setClassifications($classifications): Parameter
  651.     {
  652.         $this->classifications $classifications;
  653.         return $this;
  654.     }
  655.     public function getClassifications(): array
  656.     {
  657.         return $this->classifications;
  658.     }
  659.     public function setFacilities($facilities): Parameter
  660.     {
  661.         $this->facilities $facilities;
  662.         return $this;
  663.     }
  664.     public function getFacilities(): array
  665.     {
  666.         return $this->facilities;
  667.     }
  668.     public function setFullText(string $fullText): self
  669.     {
  670.         $this->fullText $fullText;
  671.         return $this;
  672.     }
  673.     public function getFullText(): ?string
  674.     {
  675.         return $this->fullText;
  676.     }
  677.     public function setMarketingGroups(array $marketingGroups): self
  678.     {
  679.         $this->marketingGroups $marketingGroups;
  680.         return $this;
  681.     }
  682.     public function getMarketingGroups(): array
  683.     {
  684.         return $this->marketingGroups;
  685.     }
  686.     public function setStars(array $stars): self
  687.     {
  688.         $this->stars $stars;
  689.         return $this;
  690.     }
  691.     public function getStars(): array
  692.     {
  693.         return $this->stars;
  694.     }
  695.     public function setTopOnly(bool $topOnly): Parameter
  696.     {
  697.         $this->topOnly $topOnly;
  698.         return $this;
  699.     }
  700.     public function getTopOnly(): ?bool
  701.     {
  702.         return $this->topOnly;
  703.     }
  704.     public function setDistricts($districts): Parameter
  705.     {
  706.         $this->districts $districts;
  707.         return $this;
  708.     }
  709.     public function getDistricts(): array
  710.     {
  711.         return $this->districts;
  712.     }
  713.     public function getFacilityOperator(): string
  714.     {
  715.         return $this->facilityOperator;
  716.     }
  717.     public function setHotelChains($hotelChains): Parameter
  718.     {
  719.         $this->hotelChains $hotelChains;
  720.         return $this;
  721.     }
  722.     public function getHotelChains(): array
  723.     {
  724.         return $this->hotelChains;
  725.     }
  726.     public function setAccommodationType(array $accommodationTypeId): self
  727.     {
  728.         $this->accommodationType $accommodationTypeId;
  729.         return $this;
  730.     }
  731.     public function getAccommodationType(): array
  732.     {
  733.         return $this->accommodationType;
  734.     }
  735.     public function setProductType(string $productType): self
  736.     {
  737.         $this->productType $productType;
  738.         return $this;
  739.     }
  740.     public function getProductType(): ?string
  741.     {
  742.         return $this->productType;
  743.     }
  744.     public function setLastAvailabilitiyChangeDays(string $lastAvailabilitiyChangeDays): Parameter
  745.     {
  746.         $this->lastAvailabilitiyChangeDays $lastAvailabilitiyChangeDays;
  747.         return $this;
  748.     }
  749.     public function getLastAvailabilitiyChangeDays(): ?string
  750.     {
  751.         return $this->lastAvailabilitiyChangeDays;
  752.     }
  753.     public function getHolidayThemesOperator(): string
  754.     {
  755.         return $this->holidayThemesOperator;
  756.     }
  757.     public function setHolidayThemes($holidayThemes): Parameter
  758.     {
  759.         $this->holidayThemes $holidayThemes;
  760.         return $this;
  761.     }
  762.     public function getHolidayThemes(): array
  763.     {
  764.         return $this->holidayThemes;
  765.     }
  766.     public function setSearchType(?string $searchType): self
  767.     {
  768.         $this->searchType $searchType;
  769.         return $this;
  770.     }
  771.     public function getSearchType(): ?string
  772.     {
  773.         return $this->searchType;
  774.     }
  775.     public function setOrder(array|string|null $order): self
  776.     {
  777.         $this->order $order;
  778.         return $this;
  779.     }
  780.     public function getOrder(): array|string|null
  781.     {
  782.         return $this->order;
  783.     }
  784.     public function setResponseType(string $responseType): Parameter
  785.     {
  786.         $this->responseType $responseType;
  787.         return $this;
  788.     }
  789.     public function getResponseType(): string
  790.     {
  791.         return $this->responseType;
  792.     }
  793.     public function convertToDesklineParams(): array
  794.     {
  795.         $desklineSearchParams = [];
  796.         $singleAccoLiveSearch is_array($this->getAccoIds()) && count($this->accoIds) == && !$this->getIsCorridor() && !$this->isNoDate();
  797.         foreach ($this->getRoomrows() as $roomConfig) {
  798.             $desklineSearchParam = new AccommodationInterface(
  799.                 $roomConfig->getUnits(),
  800.                 $roomConfig->getAdults(),
  801.                 $this->getDateFrom(),
  802.                 $this->getDateTo()
  803.             );
  804.             if ($roomConfig->getChildAges()) {
  805.                 $desklineSearchParam->setChildrenAges($roomConfig->getChildAges());
  806.             }
  807.             if (!($singleAccoLiveSearch && in_array('bookOnly'$this->ignoreFiltersInAccoDetailSearch))) {
  808.                 $desklineSearchParam->setBookOnly(boolval($this->getBookOnly()));
  809.             }
  810.             if (!($singleAccoLiveSearch && in_array('facilities'$this->ignoreFiltersInAccoDetailSearch))) {
  811.                 $desklineSearchParam->setAccommodationFacilityIds($this->getFacilities());
  812.             }
  813.             if (!($singleAccoLiveSearch && in_array('apartmentFacilities'$this->ignoreFiltersInAccoDetailSearch) && in_array('roomFacilities'$this->ignoreFiltersInAccoDetailSearch))) {
  814.                 $desklineSearchParam->setServiceFacilityIds(array_unique(array_merge($this->getRoomFacilities(), $this->getApartmentFacilities())));
  815.             }
  816.             if (!($singleAccoLiveSearch && in_array('accommodationTypeId'$this->ignoreFiltersInAccoDetailSearch))) {
  817.                 $accommodationTypes $this->getAccommodationType();
  818.                 if (!empty($accommodationTypes)) {
  819.                     $desklineSearchParam->setAccommodationTypeId($accommodationTypes[0] ?? '');
  820.                 }
  821.             }
  822.             //servicecode is an array locally
  823.             if (!($singleAccoLiveSearch && in_array('serviceCode'$this->ignoreFiltersInAccoDetailSearch))) {
  824.                 $serviceCodes $this->getServiceCode();
  825.                 if (!empty($serviceCodes)) {
  826.                     $desklineSearchParam->setServiceCode($serviceCodes[0]);
  827.                 }
  828.             }
  829.             if (!($singleAccoLiveSearch && in_array('categories'$this->ignoreFiltersInAccoDetailSearch))) {
  830.                 $desklineSearchParam->setCategoryIds($this->getCategories());
  831.             }
  832.             if (!($singleAccoLiveSearch && in_array('hotelChains'$this->ignoreFiltersInAccoDetailSearch))) {
  833.                 $desklineSearchParam->setChainIds($this->getHotelChains());
  834.             }
  835.             if (!($singleAccoLiveSearch && in_array('districts'$this->ignoreFiltersInAccoDetailSearch))) {
  836.                 $desklineSearchParam->setDistrictIds($this->getDistricts());
  837.             }
  838.             if (!($singleAccoLiveSearch && in_array('classificationIds'$this->ignoreFiltersInAccoDetailSearch))) {
  839.                 //leave classification out for live search if classificationStarsOperater is OR because deskline cant do that
  840.                 if ($this->getClassificationStarsOperator() !== 'OR') {
  841.                     $desklineSearchParam->setClassificationIds($this->getClassifications());
  842.                 }
  843.             }
  844.             if ($this->getLastAvailabilitiyChangeDays() !== null) {
  845.                 $desklineSearchParam->setLastAvailabilityChangeDays($this->getLastAvailabilitiyChangeDays());
  846.             }
  847.             if (!($singleAccoLiveSearch && in_array('holidayThemes'$this->ignoreFiltersInAccoDetailSearch))) {
  848.                 $desklineSearchParam->setHolidayThemeIds($this->getHolidayThemes());
  849.             }
  850.             if (!($singleAccoLiveSearch && in_array('marketingGroupIds'$this->ignoreFiltersInAccoDetailSearch))) {
  851.                 //check if mgs are Collections. IF so set Marketinggroups to empty as Deskline does not support it
  852.                 $mgs is_array(current($this->getMarketingGroups())) ? [] : $this->getMarketingGroups();
  853.                 $desklineSearchParam->setMarketingGroupIds($mgs);
  854.             }
  855.             //todo: searchParams should return townIds not only one! same for region!
  856.             if (!($singleAccoLiveSearch && in_array('towns'$this->ignoreFiltersInAccoDetailSearch))) {
  857.                 $desklineSearchParam->setTownIds($this->getTowns());
  858.             }
  859.             if (!($singleAccoLiveSearch && in_array('regions'$this->ignoreFiltersInAccoDetailSearch))) {
  860.                 $desklineSearchParam->setRegionIds($this->getRegions());
  861.             }
  862.             if (!($singleAccoLiveSearch && in_array('stars'$this->ignoreFiltersInAccoDetailSearch))) {
  863.                 $desklineSearchParam->setStarIds($this->getStars());
  864.             }
  865.             $desklineSearchParam->setNights($this->getPeriod());
  866.             if (!($singleAccoLiveSearch && in_array('productType'$this->ignoreFiltersInAccoDetailSearch))) {
  867.                 if ($this->getProductType() !== null) {
  868.                     $desklineSearchParam->setProductTypeId($this->getProductType());
  869.                 }
  870.             }
  871.             if ($this->getMealTypeId()) {
  872.                 $mealtype $this->getMealTypeId();
  873.                 if (is_array($mealtype)) {
  874.                     $mealtype $mealtype[0];
  875.                 }
  876.                 $mealtype MealType::getById($mealtype);
  877.                 if ($mealtype) {
  878.                     $desklineSearchParam->setMealTypeId($mealtype->getFid());
  879.                 }
  880.             }
  881.             if ($this->getProductId()) {
  882.                 $desklineSearchParam->setProductId($this->getProductId());
  883.             }
  884.             $pids $this->getProductIds();
  885.             if (!empty($pids) && count($pids) == 1) {
  886.                 $desklineSearchParam->setProductId($pids[0]);
  887.             }
  888.             $desklineSearchParam->setServiceProviderIds($this->accoIds ?? []);
  889.             $desklineSearchParam->setServiceProviderFIds($this->accoFIds ?? []);
  890.             if (empty($this->accoFIds) && empty($this->accoIds) && $this->getName() !== null) {
  891.                 $desklineSearchParam->setServiceProviderName($this->getName());
  892.             }
  893.             if ($this->salesChannelId) {
  894.                 $salesChannel SalesChannel::getById($this->salesChannelId);
  895.                 if ($salesChannel) {
  896.                     $desklineSearchParam->setSalesChannel($salesChannel->getFid());
  897.                 }
  898.             }
  899.             if (!($singleAccoLiveSearch && in_array('minAmountSleepingRooms'$this->ignoreFiltersInAccoDetailSearch))) {
  900.                 $minSleepingRooms $roomConfig->getMinSleepingRooms() ?: $this->getMinAmountSleepingRooms();
  901.                 if ($minSleepingRooms !== null) {
  902.                     $desklineSearchParam->setMinAmountSleepingRooms($minSleepingRooms);
  903.                 }
  904.             }
  905.             if (!($singleAccoLiveSearch && in_array('accommodationType'$this->ignoreFiltersInAccoDetailSearch))) {
  906.                 $desklineSearchParam->setAccommodationTypeId($roomConfig->getAccommodationType());
  907.             }
  908.             if (!($singleAccoLiveSearch && in_array('priceFrom'$this->ignoreFiltersInAccoDetailSearch) && in_array('priceTo'$this->ignoreFiltersInAccoDetailSearch))) {
  909.                 $desklineSearchParam->setMaxPrice($this->getPriceTo());
  910.                 if ($this->getPriceFrom() >= && $this->getPriceTo() > 0) {
  911.                     $desklineSearchParam->setRangeMaxPrice($this->getPriceTo());
  912.                     $desklineSearchParam->setRangeMinPrice($this->getPriceFrom());
  913.                 }
  914.             }
  915.             $desklineSearchParams[] = $desklineSearchParam;
  916.         }
  917.         return $desklineSearchParams;
  918.     }
  919.     public function getMealCode(): ?string
  920.     {
  921.         if (!$this->mealCode && $this->mealTypeId) {
  922.             $mealType MealType::getById($this->mealTypeId);
  923.             if ($mealType) {
  924.                 $this->mealCode $mealType->getFid();
  925.                 return $this->mealCode;
  926.             }
  927.             $mealType MealType::getByFid($this->mealTypeId);
  928.             if ($mealType) {
  929.                 $this->mealCode $mealType->getFid();
  930.                 return $this->mealCode;
  931.             }
  932.         }
  933.         return $this->mealCode;
  934.     }
  935.     public function setProductId(mixed $productId): self
  936.     {
  937.         $this->productId $productId;
  938.         return $this;
  939.     }
  940.     public function getProductId(): mixed
  941.     {
  942.         return $this->productId;
  943.     }
  944.     public function setAccoFIds($accoFIds): Parameter
  945.     {
  946.         $this->accoFIds $accoFIds;
  947.         return $this;
  948.     }
  949.     public function getAccoFIds(): ?array
  950.     {
  951.         return $this->accoFIds;
  952.     }
  953.     public function getMinAmountSleepingRooms(): ?int
  954.     {
  955.         return $this->minAmountSleepingRooms;
  956.     }
  957.     public function setMinAmountSleepingRooms(?int $minAmountSleepingRooms): self
  958.     {
  959.         $this->minAmountSleepingRooms $minAmountSleepingRooms;
  960.         return $this;
  961.     }
  962.     public function setOrderRandSeed(int $orderRandSeed): Parameter
  963.     {
  964.         $this->orderRandSeed $orderRandSeed;
  965.         return $this;
  966.     }
  967.     public function getOrderRandSeed(): int
  968.     {
  969.         return $this->orderRandSeed;
  970.     }
  971.     public function getBookOnRequestAsBookable(): bool
  972.     {
  973.         return $this->bookOnRequestAsBookable;
  974.     }
  975.     public function getDaccoRelTableNeeded(): bool
  976.     {
  977.         return $this->daccoRelTableNeeded;
  978.     }
  979.     public function getProductTableNeeded(): bool
  980.     {
  981.         return $this->productTableNeeded;
  982.     }
  983.     public function setRefilterCustomOrder($refilterCustomOrder): Parameter
  984.     {
  985.         $this->refilterCustomOrder $refilterCustomOrder;
  986.         return $this;
  987.     }
  988.     public function getRefilterCustomOrder(): array
  989.     {
  990.         return $this->refilterCustomOrder;
  991.     }
  992.     public function getServiceRelTableNeeded(): bool
  993.     {
  994.         return $this->serviceRelTableNeeded;
  995.     }
  996.     public function setServiceTableNeeded($serviceTableNeeded): Parameter
  997.     {
  998.         $this->serviceTableNeeded $serviceTableNeeded;
  999.         return $this;
  1000.     }
  1001.     public function getServiceTableNeeded(): bool
  1002.     {
  1003.         return $this->serviceTableNeeded;
  1004.     }
  1005.     public function setPriceFrom(float $priceFrom): self
  1006.     {
  1007.         $this->priceFrom $priceFrom;
  1008.         return $this;
  1009.     }
  1010.     public function getPriceFrom(): float
  1011.     {
  1012.         return $this->priceFrom;
  1013.     }
  1014.     public function setPriceTo(float $priceTo): self
  1015.     {
  1016.         $this->priceTo $priceTo;
  1017.         return $this;
  1018.     }
  1019.     public function getPriceTo(): float
  1020.     {
  1021.         return $this->priceTo;
  1022.     }
  1023.     #[Pure]
  1024.  public function getPriceRangeFrom(): ?float
  1025.  {
  1026.      if (empty($this->priceRangeFrom)) {
  1027.          return $this->getPriceFrom();
  1028.      }
  1029.      return $this->priceRangeFrom;
  1030.  }
  1031.     #[Pure]
  1032.  public function getPriceRangeTo(): float
  1033.  {
  1034.      if (empty($this->priceRangeTo)) {
  1035.          return $this->getPriceTo();
  1036.      }
  1037.      return $this->priceRangeTo;
  1038.  }
  1039.     public function setUnpublished($unpublished): Parameter
  1040.     {
  1041.         $this->unpublished $unpublished;
  1042.         return $this;
  1043.     }
  1044.     public function getUnpublished(): bool
  1045.     {
  1046.         return $this->unpublished;
  1047.     }
  1048.     public function setExtendedResultset(bool $extendedResultset): self
  1049.     {
  1050.         $this->extendedResultset $extendedResultset;
  1051.         return $this;
  1052.     }
  1053.     public function getExtendedResultset(): bool
  1054.     {
  1055.         return $this->extendedResultset;
  1056.     }
  1057.     public function setMinPrice($minPrice): Parameter
  1058.     {
  1059.         $this->minPrice $minPrice;
  1060.         return $this;
  1061.     }
  1062.     public function getMinPrice(): int
  1063.     {
  1064.         return $this->minPrice;
  1065.     }
  1066.     public function getMinPriceBound(): float|int
  1067.     {
  1068.         return $this->minPriceBound;
  1069.     }
  1070.     public function getTopFirst(): ?int
  1071.     {
  1072.         return $this->topFirst;
  1073.     }
  1074.     public function setServiceCode(mixed $serviceCode): self
  1075.     {
  1076.         $this->serviceCode = (array)$serviceCode;
  1077.         return $this;
  1078.     }
  1079.     public function getServiceCode(): array
  1080.     {
  1081.         return $this->serviceCode;
  1082.     }
  1083.     public function getClassificationStarsOperator(): string
  1084.     {
  1085.         return $this->classificationStarsOperator;
  1086.     }
  1087.     public function setNotBookOnly(bool $notBookOnly): self
  1088.     {
  1089.         $this->notBookOnly $notBookOnly;
  1090.         return $this;
  1091.     }
  1092.     public function getNotBookOnly(): ?bool
  1093.     {
  1094.         return $this->notBookOnly;
  1095.     }
  1096.     public function setCheckTestHotels(bool $checkTestHotels): self
  1097.     {
  1098.         $this->checkTestHotels $checkTestHotels;
  1099.         return $this;
  1100.     }
  1101.     public function getCheckTestHotels(): bool
  1102.     {
  1103.         return $this->checkTestHotels;
  1104.     }
  1105.     public function setIsCorridor(bool $isCorridor): self
  1106.     {
  1107.         $this->isCorridor $isCorridor;
  1108.         return $this;
  1109.     }
  1110.     public function getIsCorridor(): bool
  1111.     {
  1112.         return $this->isCorridor;
  1113.     }
  1114.     public function setIsAlternative(bool $isAlternative): self
  1115.     {
  1116.         $this->isAlternative $isAlternative;
  1117.         return $this;
  1118.     }
  1119.     public function getIsAlternative(): bool
  1120.     {
  1121.         return $this->isAlternative;
  1122.     }
  1123.     public function setPreviousResults(int $previousResults): self
  1124.     {
  1125.         $this->previousResults $previousResults;
  1126.         return $this;
  1127.     }
  1128.     public function getPreviousResults(): int
  1129.     {
  1130.         return $this->previousResults;
  1131.     }
  1132.     public function setNights(array $nights): self
  1133.     {
  1134.         $this->nights $nights;
  1135.         return $this;
  1136.     }
  1137.     public function getNights(): array
  1138.     {
  1139.         return $this->nights;
  1140.     }
  1141.     public function setProductIds(mixed $productIds): self
  1142.     {
  1143.         $ints = [];
  1144.         foreach ((array)$productIds as $productId) {
  1145.             $ints[] = (int)$productId;
  1146.         }
  1147.         $this->productIds $ints;
  1148.         return $this;
  1149.     }
  1150.     public function getProductIds(): ?array
  1151.     {
  1152.         return $this->productIds;
  1153.     }
  1154.     public function getMinRatingCountForSort(): int
  1155.     {
  1156.         return $this->minRatingCountForSort;
  1157.     }
  1158.     public function getSkipBaseFilter(): bool
  1159.     {
  1160.         return $this->skipBaseFilter;
  1161.     }
  1162.     public function setCalculateStandardPrice(bool $calculateStandardPrice): self
  1163.     {
  1164.         $this->calculateStandardPrice $calculateStandardPrice;
  1165.         return $this;
  1166.     }
  1167.     public function getCalculateStandardPrice(): bool
  1168.     {
  1169.         return $this->calculateStandardPrice;
  1170.     }
  1171.     public function getFacilityGroup(): array
  1172.     {
  1173.         //dummy return value
  1174.         return [];
  1175.     }
  1176.     public function setParameterFromMixedObjects(array $filterObjects): static
  1177.     {
  1178.         foreach ($filterObjects as $obj) {
  1179.             // set all Towns from region
  1180.             if ($obj instanceof Region) {
  1181.                 $currentFilters $this->getTowns();
  1182.                 foreach ($obj->getChildren() as $town) {
  1183.                     if ($town instanceof Town) {
  1184.                         $currentFilters[] = $town->getId();
  1185.                     }
  1186.                 }
  1187.                 $this->setTowns($currentFilters);
  1188.                 continue;
  1189.             }
  1190.             $class get_class($obj);
  1191.             $classArray explode('\\'$class);
  1192.             $setter 'set' end($classArray);
  1193.             $getter 'get' end($classArray);
  1194.             $ssetter 'set' end($classArray) . 's';
  1195.             $sgetter 'get' end($classArray) . 's';
  1196.             if (method_exists($this$getter) && method_exists($this$setter)) {
  1197.                 $currentFilters $this->$getter();
  1198.                 $currentFilters[] = $obj->getId();
  1199.                 $this->$setter($currentFilters);
  1200.             } elseif (method_exists($this$sgetter) && method_exists($this$ssetter)) {
  1201.                 $currentFilters $this->$sgetter();
  1202.                 $currentFilters[] = $obj->getId();
  1203.                 $this->$ssetter((array)$currentFilters);
  1204.             }
  1205.         }
  1206.         return $this;
  1207.     }
  1208.     public function setAccommodationServiceProvider(array $accoIds): Parameter
  1209.     {
  1210.         $this->setAccoIds($accoIds);
  1211.         return $this;
  1212.     }
  1213.     #[Pure]
  1214.  public function getAccommodationServiceProvider(): ?array
  1215.  {
  1216.      return $this->getAccoIds();
  1217.  }
  1218.     public function setAccommodationProducts($productIds): Parameter
  1219.     {
  1220.         $this->setProductIds($productIds);
  1221.         return $this;
  1222.     }
  1223.     #[Pure]
  1224.  public function getAccommodationProducts(): ?array
  1225.  {
  1226.      return $this->getProductIds();
  1227.  }
  1228.     public function setLanguage($language): self
  1229.     {
  1230.         $this->language $language;
  1231.         return $this;
  1232.     }
  1233.     public function getLanguage(): ?string
  1234.     {
  1235.         return $this->language;
  1236.     }
  1237.     public function setCategory($categories): Parameter
  1238.     {
  1239.         $cats = [];
  1240.         foreach ($categories as $cat) {
  1241.             if (empty($cat)) {
  1242.                 continue;
  1243.             }
  1244.             if ($cat instanceof AbstractObject) {
  1245.                 $cats[] = $cat->getId();
  1246.             } else {
  1247.                 $cats[] = $cat;
  1248.             }
  1249.         }
  1250.         $this->setCategories($cats);
  1251.         return $this;
  1252.     }
  1253.     #[Pure]
  1254.  public function getCategory(): array
  1255.  {
  1256.      return $this->getCategories();
  1257.  }
  1258.     public function setFacility($facilities): Parameter
  1259.     {
  1260.         $objs = [];
  1261.         foreach ($facilities as $obj) {
  1262.             if (empty($obj)) {
  1263.                 continue;
  1264.             }
  1265.             if ($obj instanceof AbstractObject) {
  1266.                 $objs[] = $obj->getId();
  1267.             } else {
  1268.                 $objs[] = $obj;
  1269.             }
  1270.         }
  1271.         $this->setFacilities($objs);
  1272.         return $this;
  1273.     }
  1274.     #[Pure]
  1275.  public function getFacility(): array
  1276.  {
  1277.      return $this->getFacilities();
  1278.  }
  1279.     public function setMealType($mealTypeId): Parameter
  1280.     {
  1281.         $this->setMealTypeId($mealTypeId);
  1282.         return $this;
  1283.     }
  1284.     #[Pure]
  1285.  public function getMealType(): ?string
  1286.  {
  1287.      return $this->getMealTypeId();
  1288.  }
  1289.     public function getFacilityCombinationOperator(): string
  1290.     {
  1291.         return $this->facilityCombinationOperator;
  1292.     }
  1293.     public function getUseMultiLineMerge(): ?bool
  1294.     {
  1295.         return $this->useMultiLineMerge;
  1296.     }
  1297.     public function setUseMultiLineMerge(bool $useMultiLineMerge): self
  1298.     {
  1299.         $this->useMultiLineMerge $useMultiLineMerge;
  1300.         return $this;
  1301.     }
  1302.     public function getRoomFacilities(): array
  1303.     {
  1304.         return $this->roomFacilities;
  1305.     }
  1306.     public function setRoomFacilities(mixed $roomFacilities): self
  1307.     {
  1308.         //check if empty
  1309.         $tmp = [];
  1310.         if (is_array($roomFacilities)) {
  1311.             foreach ($roomFacilities as $roomFacility) {
  1312.                 if (!empty($roomFacility)) {
  1313.                     $tmp[] = $roomFacility;
  1314.                 }
  1315.             }
  1316.         } elseif (!empty($roomFacilities)) {
  1317.             $tmp[] = (int)$roomFacilities;
  1318.         }
  1319.         $this->roomFacilities $tmp;
  1320.         return $this;
  1321.     }
  1322.     public function getApartmentFacilities(): array
  1323.     {
  1324.         return $this->apartmentFacilities;
  1325.     }
  1326.     public function setApartmentFacilities(mixed $apartmentFacilities): self
  1327.     {
  1328.         //check if empty
  1329.         $tmp = [];
  1330.         if (is_array($apartmentFacilities)) {
  1331.             foreach ($apartmentFacilities as $apartmentFacility) {
  1332.                 if (!empty($apartmentFacility)) {
  1333.                     $tmp[] = $apartmentFacility;
  1334.                 }
  1335.             }
  1336.         } elseif (!empty($apartmentFacilities)) {
  1337.             $tmp[] = (int)$apartmentFacilities;
  1338.         }
  1339.         $this->apartmentFacilities $tmp;
  1340.         return $this;
  1341.     }
  1342.     public function getExcludeAccoIds(): ?array
  1343.     {
  1344.         return $this->excludeAccoIds;
  1345.     }
  1346.     public function setExcludeAccoIds(array $excludeAccoIds): self
  1347.     {
  1348.         $this->excludeAccoIds $excludeAccoIds;
  1349.         return $this;
  1350.     }
  1351.     public function getPriority(): ?int
  1352.     {
  1353.         return $this->priority;
  1354.     }
  1355.     public function setPriority(int $priority): self
  1356.     {
  1357.         $this->priority $priority;
  1358.         return $this;
  1359.     }
  1360.     public function getPriorityOperator(): string
  1361.     {
  1362.         return $this->priorityOperator;
  1363.     }
  1364.     public function isSpecialsOnly(): mixed
  1365.     {
  1366.         return $this->specialsOnly;
  1367.     }
  1368.     public function setSpecialsOnly(mixed $specialsOnly): self
  1369.     {
  1370.         $this->specialsOnly $specialsOnly;
  1371.         return $this;
  1372.     }
  1373.     public function isBestpriceOnly(): bool
  1374.     {
  1375.         return $this->bestpriceOnly;
  1376.     }
  1377.     public function setBestpriceOnly(bool $bestpriceOnly): self
  1378.     {
  1379.         $this->bestpriceOnly $bestpriceOnly;
  1380.         return $this;
  1381.     }
  1382.     public function isBestpriceProvider(): mixed
  1383.     {
  1384.         return $this->bestpriceProvider;
  1385.     }
  1386.     public function setBestpriceProvider(mixed $bestpriceProvider): self
  1387.     {
  1388.         $this->bestpriceProvider $bestpriceProvider;
  1389.         return $this;
  1390.     }
  1391.     public function getSpecialsOperator(): string
  1392.     {
  1393.         return $this->specialsOperator;
  1394.     }
  1395.     public function getAllTopsFirst(): bool
  1396.     {
  1397.         return $this->allTopsFirst;
  1398.     }
  1399.     public function isTicketingOnly(): ?bool
  1400.     {
  1401.         return $this->ticketingOnly;
  1402.     }
  1403.     public function getStarsTableNeeded(): bool
  1404.     {
  1405.         return $this->starsTableNeeded;
  1406.     }
  1407.     public function setStarsTableNeeded(bool $starsTableNeeded): self
  1408.     {
  1409.         $this->starsTableNeeded $starsTableNeeded;
  1410.         return $this;
  1411.     }
  1412.     public function getSpecialSpecific(): array
  1413.     {
  1414.         return $this->specialSpecific;
  1415.     }
  1416.     public function setSpecialSpecific(array $specialSpecific): ?self
  1417.     {
  1418.         if (!empty($this->getExcludeSpecialSpecific())) {
  1419.             return null;
  1420.         }
  1421.         $this->specialSpecific $specialSpecific;
  1422.         return $this;
  1423.     }
  1424.     public function getExcludeSpecialSpecific(): array
  1425.     {
  1426.         return $this->excludeSpecialSpecific;
  1427.     }
  1428.     public function setExcludeSpecialSpecific(mixed $excludeSpecialSpecific): ?self
  1429.     {
  1430.         if (!empty($this->getSpecialSpecific())) {
  1431.             return null;
  1432.         }
  1433.         if (!is_array($excludeSpecialSpecific)) {
  1434.             $excludeSpecialSpecific = [$excludeSpecialSpecific];
  1435.         }
  1436.         $this->excludeSpecialSpecific $excludeSpecialSpecific;
  1437.         return $this;
  1438.     }
  1439.     public function getFreeCancellation(): bool
  1440.     {
  1441.         return $this->freeCancellation;
  1442.     }
  1443.     public function setFreeCancellation(bool $freeCancellation): void
  1444.     {
  1445.         $this->freeCancellation $freeCancellation;
  1446.     }
  1447.     public function getContentScore(): int
  1448.     {
  1449.         return $this->contentScore;
  1450.     }
  1451.     public function setContentScore(int $contentScore): void
  1452.     {
  1453.         $this->contentScore $contentScore;
  1454.     }
  1455.     public function setBookOnRequestAsBookable(bool $bookOnRequestAsBookable): void
  1456.     {
  1457.         $this->bookOnRequestAsBookable $bookOnRequestAsBookable;
  1458.     }
  1459. }