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.         if(!$this->dateFrom && is_array($this->accoIds) && count($this->accoIds) == 1){
  620.             //single acco without search date - use acco id
  621.             $string reset($this->accoIds)."SingleAccoNoSearch".strval($this->searchType);
  622.         } else {
  623.             //TODO this does not work, hash differs with each instance, but caching is not used when dateFrom set so it doesn't matter
  624.             $string serialize($this) . ':' $page ':' $pagesize//needed for live search
  625.         }
  626.         return md5($string);
  627.     }
  628.     public function getVacancyCacheHash(): string
  629.     {
  630.         $roomRowString '';
  631.         foreach ($this->getRoomrows() as $row) {
  632.             $roomRowString .= $row->getVacancyCacheString();
  633.         }
  634.         if ($this->dateFrom && $this->dateTo) {
  635.             return md5($this->dateFrom->format('YMD') . ',' .
  636.                 $this->dateTo->format('YMD') . ',' .
  637.                 $this->getPeriod() . ',' .
  638.                 $roomRowString);
  639.         }
  640.         return md5($roomRowString);
  641.     }
  642.     public function addRoomRow($row): Parameter
  643.     {
  644.         $this->roomrows[] = $row;
  645.         return $this;
  646.     }
  647.     public function setBookOnly(bool $bookOnly): self
  648.     {
  649.         $this->bookOnly $bookOnly;
  650.         return $this;
  651.     }
  652.     public function getBookOnly(): ?bool
  653.     {
  654.         return $this->bookOnly;
  655.     }
  656.     public function setClassifications($classifications): Parameter
  657.     {
  658.         $this->classifications $classifications;
  659.         return $this;
  660.     }
  661.     public function getClassifications(): array
  662.     {
  663.         return $this->classifications;
  664.     }
  665.     public function setFacilities($facilities): Parameter
  666.     {
  667.         $this->facilities $facilities;
  668.         return $this;
  669.     }
  670.     public function getFacilities(): array
  671.     {
  672.         return $this->facilities;
  673.     }
  674.     public function setFullText(string $fullText): self
  675.     {
  676.         $this->fullText $fullText;
  677.         return $this;
  678.     }
  679.     public function getFullText(): ?string
  680.     {
  681.         return $this->fullText;
  682.     }
  683.     public function setMarketingGroups(array $marketingGroups): self
  684.     {
  685.         $this->marketingGroups $marketingGroups;
  686.         return $this;
  687.     }
  688.     public function getMarketingGroups(): array
  689.     {
  690.         return $this->marketingGroups;
  691.     }
  692.     public function setStars(array $stars): self
  693.     {
  694.         $this->stars $stars;
  695.         return $this;
  696.     }
  697.     public function getStars(): array
  698.     {
  699.         return $this->stars;
  700.     }
  701.     public function setTopOnly(bool $topOnly): Parameter
  702.     {
  703.         $this->topOnly $topOnly;
  704.         return $this;
  705.     }
  706.     public function getTopOnly(): ?bool
  707.     {
  708.         return $this->topOnly;
  709.     }
  710.     public function setDistricts($districts): Parameter
  711.     {
  712.         $this->districts $districts;
  713.         return $this;
  714.     }
  715.     public function getDistricts(): array
  716.     {
  717.         return $this->districts;
  718.     }
  719.     public function getFacilityOperator(): string
  720.     {
  721.         return $this->facilityOperator;
  722.     }
  723.     public function setHotelChains($hotelChains): Parameter
  724.     {
  725.         $this->hotelChains $hotelChains;
  726.         return $this;
  727.     }
  728.     public function getHotelChains(): array
  729.     {
  730.         return $this->hotelChains;
  731.     }
  732.     public function setAccommodationType(array $accommodationTypeId): self
  733.     {
  734.         $this->accommodationType $accommodationTypeId;
  735.         return $this;
  736.     }
  737.     public function getAccommodationType(): array
  738.     {
  739.         return $this->accommodationType;
  740.     }
  741.     public function setProductType(string $productType): self
  742.     {
  743.         $this->productType $productType;
  744.         return $this;
  745.     }
  746.     public function getProductType(): ?string
  747.     {
  748.         return $this->productType;
  749.     }
  750.     public function setLastAvailabilitiyChangeDays(string $lastAvailabilitiyChangeDays): Parameter
  751.     {
  752.         $this->lastAvailabilitiyChangeDays $lastAvailabilitiyChangeDays;
  753.         return $this;
  754.     }
  755.     public function getLastAvailabilitiyChangeDays(): ?string
  756.     {
  757.         return $this->lastAvailabilitiyChangeDays;
  758.     }
  759.     public function getHolidayThemesOperator(): string
  760.     {
  761.         return $this->holidayThemesOperator;
  762.     }
  763.     public function setHolidayThemes($holidayThemes): Parameter
  764.     {
  765.         $this->holidayThemes $holidayThemes;
  766.         return $this;
  767.     }
  768.     public function getHolidayThemes(): array
  769.     {
  770.         return $this->holidayThemes;
  771.     }
  772.     public function setSearchType(?string $searchType): self
  773.     {
  774.         $this->searchType $searchType;
  775.         return $this;
  776.     }
  777.     public function getSearchType(): ?string
  778.     {
  779.         return $this->searchType;
  780.     }
  781.     public function setOrder(array|string|null $order): self
  782.     {
  783.         $this->order $order;
  784.         return $this;
  785.     }
  786.     public function getOrder(): array|string|null
  787.     {
  788.         return $this->order;
  789.     }
  790.     public function setResponseType(string $responseType): Parameter
  791.     {
  792.         $this->responseType $responseType;
  793.         return $this;
  794.     }
  795.     public function getResponseType(): string
  796.     {
  797.         return $this->responseType;
  798.     }
  799.     public function convertToDesklineParams(): array
  800.     {
  801.         $desklineSearchParams = [];
  802.         $singleAccoLiveSearch is_array($this->getAccoIds()) && count($this->accoIds) == && !$this->getIsCorridor() && !$this->isNoDate();
  803.         foreach ($this->getRoomrows() as $roomConfig) {
  804.             $desklineSearchParam = new AccommodationInterface(
  805.                 $roomConfig->getUnits(),
  806.                 $roomConfig->getAdults(),
  807.                 $this->getDateFrom(),
  808.                 $this->getDateTo()
  809.             );
  810.             if ($roomConfig->getChildAges()) {
  811.                 $desklineSearchParam->setChildrenAges($roomConfig->getChildAges());
  812.             }
  813.             if (!($singleAccoLiveSearch && in_array('bookOnly'$this->ignoreFiltersInAccoDetailSearch))) {
  814.                 $desklineSearchParam->setBookOnly(boolval($this->getBookOnly()));
  815.             }
  816.             if (!($singleAccoLiveSearch && in_array('facilities'$this->ignoreFiltersInAccoDetailSearch))) {
  817.                 $desklineSearchParam->setAccommodationFacilityIds($this->getFacilities());
  818.             }
  819.             if (!($singleAccoLiveSearch && in_array('apartmentFacilities'$this->ignoreFiltersInAccoDetailSearch) && in_array('roomFacilities'$this->ignoreFiltersInAccoDetailSearch))) {
  820.                 $desklineSearchParam->setServiceFacilityIds(array_unique(array_merge($this->getRoomFacilities(), $this->getApartmentFacilities())));
  821.             }
  822.             if (!($singleAccoLiveSearch && in_array('accommodationTypeId'$this->ignoreFiltersInAccoDetailSearch))) {
  823.                 $accommodationTypes $this->getAccommodationType();
  824.                 if (!empty($accommodationTypes)) {
  825.                     $desklineSearchParam->setAccommodationTypeId($accommodationTypes[0] ?? '');
  826.                 }
  827.             }
  828.             //servicecode is an array locally
  829.             if (!($singleAccoLiveSearch && in_array('serviceCode'$this->ignoreFiltersInAccoDetailSearch))) {
  830.                 $serviceCodes $this->getServiceCode();
  831.                 if (!empty($serviceCodes)) {
  832.                     $desklineSearchParam->setServiceCode($serviceCodes[0]);
  833.                 }
  834.             }
  835.             if (!($singleAccoLiveSearch && in_array('categories'$this->ignoreFiltersInAccoDetailSearch))) {
  836.                 $desklineSearchParam->setCategoryIds($this->getCategories());
  837.             }
  838.             if (!($singleAccoLiveSearch && in_array('hotelChains'$this->ignoreFiltersInAccoDetailSearch))) {
  839.                 $desklineSearchParam->setChainIds($this->getHotelChains());
  840.             }
  841.             if (!($singleAccoLiveSearch && in_array('districts'$this->ignoreFiltersInAccoDetailSearch))) {
  842.                 $desklineSearchParam->setDistrictIds($this->getDistricts());
  843.             }
  844.             if (!($singleAccoLiveSearch && in_array('classificationIds'$this->ignoreFiltersInAccoDetailSearch))) {
  845.                 //leave classification out for live search if classificationStarsOperater is OR because deskline cant do that
  846.                 if ($this->getClassificationStarsOperator() !== 'OR') {
  847.                     $desklineSearchParam->setClassificationIds($this->getClassifications());
  848.                 }
  849.             }
  850.             if ($this->getLastAvailabilitiyChangeDays() !== null) {
  851.                 $desklineSearchParam->setLastAvailabilityChangeDays($this->getLastAvailabilitiyChangeDays());
  852.             }
  853.             if (!($singleAccoLiveSearch && in_array('holidayThemes'$this->ignoreFiltersInAccoDetailSearch))) {
  854.                 $desklineSearchParam->setHolidayThemeIds($this->getHolidayThemes());
  855.             }
  856.             if (!($singleAccoLiveSearch && in_array('marketingGroupIds'$this->ignoreFiltersInAccoDetailSearch))) {
  857.                 //check if mgs are Collections. IF so set Marketinggroups to empty as Deskline does not support it
  858.                 $mgs is_array(current($this->getMarketingGroups())) ? [] : $this->getMarketingGroups();
  859.                 $desklineSearchParam->setMarketingGroupIds($mgs);
  860.             }
  861.             //todo: searchParams should return townIds not only one! same for region!
  862.             if (!($singleAccoLiveSearch && in_array('towns'$this->ignoreFiltersInAccoDetailSearch))) {
  863.                 $desklineSearchParam->setTownIds($this->getTowns());
  864.             }
  865.             if (!($singleAccoLiveSearch && in_array('regions'$this->ignoreFiltersInAccoDetailSearch))) {
  866.                 $desklineSearchParam->setRegionIds($this->getRegions());
  867.             }
  868.             if (!($singleAccoLiveSearch && in_array('stars'$this->ignoreFiltersInAccoDetailSearch))) {
  869.                 $desklineSearchParam->setStarIds($this->getStars());
  870.             }
  871.             $desklineSearchParam->setNights($this->getPeriod());
  872.             if (!($singleAccoLiveSearch && in_array('productType'$this->ignoreFiltersInAccoDetailSearch))) {
  873.                 if ($this->getProductType() !== null) {
  874.                     $desklineSearchParam->setProductTypeId($this->getProductType());
  875.                 }
  876.             }
  877.             if ($this->getMealTypeId()) {
  878.                 $mealtype $this->getMealTypeId();
  879.                 if (is_array($mealtype)) {
  880.                     $mealtype $mealtype[0];
  881.                 }
  882.                 $mealtype MealType::getById($mealtype);
  883.                 if ($mealtype) {
  884.                     $desklineSearchParam->setMealTypeId($mealtype->getFid());
  885.                 }
  886.             }
  887.             if ($this->getProductId()) {
  888.                 $desklineSearchParam->setProductId($this->getProductId());
  889.             }
  890.             $pids $this->getProductIds();
  891.             if (!empty($pids) && count($pids) == 1) {
  892.                 $desklineSearchParam->setProductId($pids[0]);
  893.             }
  894.             $desklineSearchParam->setServiceProviderIds($this->accoIds ?? []);
  895.             $desklineSearchParam->setServiceProviderFIds($this->accoFIds ?? []);
  896.             if (empty($this->accoFIds) && empty($this->accoIds) && $this->getName() !== null) {
  897.                 $desklineSearchParam->setServiceProviderName($this->getName());
  898.             }
  899.             if ($this->salesChannelId) {
  900.                 $salesChannel SalesChannel::getById($this->salesChannelId);
  901.                 if ($salesChannel) {
  902.                     $desklineSearchParam->setSalesChannel($salesChannel->getFid());
  903.                 }
  904.             }
  905.             if (!($singleAccoLiveSearch && in_array('minAmountSleepingRooms'$this->ignoreFiltersInAccoDetailSearch))) {
  906.                 $minSleepingRooms $roomConfig->getMinSleepingRooms() ?: $this->getMinAmountSleepingRooms();
  907.                 if ($minSleepingRooms !== null) {
  908.                     $desklineSearchParam->setMinAmountSleepingRooms($minSleepingRooms);
  909.                 }
  910.             }
  911.             if (!($singleAccoLiveSearch && in_array('accommodationType'$this->ignoreFiltersInAccoDetailSearch))) {
  912.                 $desklineSearchParam->setAccommodationTypeId($roomConfig->getAccommodationType());
  913.             }
  914.             if (!($singleAccoLiveSearch && in_array('priceFrom'$this->ignoreFiltersInAccoDetailSearch) && in_array('priceTo'$this->ignoreFiltersInAccoDetailSearch))) {
  915.                 $desklineSearchParam->setMaxPrice($this->getPriceTo());
  916.                 if ($this->getPriceFrom() >= && $this->getPriceTo() > 0) {
  917.                     $desklineSearchParam->setRangeMaxPrice($this->getPriceTo());
  918.                     $desklineSearchParam->setRangeMinPrice($this->getPriceFrom());
  919.                 }
  920.             }
  921.             $desklineSearchParams[] = $desklineSearchParam;
  922.         }
  923.         return $desklineSearchParams;
  924.     }
  925.     public function getMealCode(): ?string
  926.     {
  927.         if (!$this->mealCode && $this->mealTypeId) {
  928.             $mealType MealType::getById($this->mealTypeId);
  929.             if ($mealType) {
  930.                 $this->mealCode $mealType->getFid();
  931.                 return $this->mealCode;
  932.             }
  933.             $mealType MealType::getByFid($this->mealTypeId);
  934.             if ($mealType) {
  935.                 $this->mealCode $mealType->getFid();
  936.                 return $this->mealCode;
  937.             }
  938.         }
  939.         return $this->mealCode;
  940.     }
  941.     public function setProductId(mixed $productId): self
  942.     {
  943.         $this->productId $productId;
  944.         return $this;
  945.     }
  946.     public function getProductId(): mixed
  947.     {
  948.         return $this->productId;
  949.     }
  950.     public function setAccoFIds($accoFIds): Parameter
  951.     {
  952.         $this->accoFIds $accoFIds;
  953.         return $this;
  954.     }
  955.     public function getAccoFIds(): ?array
  956.     {
  957.         return $this->accoFIds;
  958.     }
  959.     public function getMinAmountSleepingRooms(): ?int
  960.     {
  961.         return $this->minAmountSleepingRooms;
  962.     }
  963.     public function setMinAmountSleepingRooms(?int $minAmountSleepingRooms): self
  964.     {
  965.         $this->minAmountSleepingRooms $minAmountSleepingRooms;
  966.         return $this;
  967.     }
  968.     public function setOrderRandSeed(int $orderRandSeed): Parameter
  969.     {
  970.         $this->orderRandSeed $orderRandSeed;
  971.         return $this;
  972.     }
  973.     public function getOrderRandSeed(): int
  974.     {
  975.         return $this->orderRandSeed;
  976.     }
  977.     public function getBookOnRequestAsBookable(): bool
  978.     {
  979.         return $this->bookOnRequestAsBookable;
  980.     }
  981.     public function getDaccoRelTableNeeded(): bool
  982.     {
  983.         return $this->daccoRelTableNeeded;
  984.     }
  985.     public function getProductTableNeeded(): bool
  986.     {
  987.         return $this->productTableNeeded;
  988.     }
  989.     public function setRefilterCustomOrder($refilterCustomOrder): Parameter
  990.     {
  991.         $this->refilterCustomOrder $refilterCustomOrder;
  992.         return $this;
  993.     }
  994.     public function getRefilterCustomOrder(): array
  995.     {
  996.         return $this->refilterCustomOrder;
  997.     }
  998.     public function getServiceRelTableNeeded(): bool
  999.     {
  1000.         return $this->serviceRelTableNeeded;
  1001.     }
  1002.     public function setServiceTableNeeded($serviceTableNeeded): Parameter
  1003.     {
  1004.         $this->serviceTableNeeded $serviceTableNeeded;
  1005.         return $this;
  1006.     }
  1007.     public function getServiceTableNeeded(): bool
  1008.     {
  1009.         return $this->serviceTableNeeded;
  1010.     }
  1011.     public function setPriceFrom(float $priceFrom): self
  1012.     {
  1013.         $this->priceFrom $priceFrom;
  1014.         return $this;
  1015.     }
  1016.     public function getPriceFrom(): float
  1017.     {
  1018.         return $this->priceFrom;
  1019.     }
  1020.     public function setPriceTo(float $priceTo): self
  1021.     {
  1022.         $this->priceTo $priceTo;
  1023.         return $this;
  1024.     }
  1025.     public function getPriceTo(): float
  1026.     {
  1027.         return $this->priceTo;
  1028.     }
  1029.     #[Pure]
  1030.  public function getPriceRangeFrom(): ?float
  1031.  {
  1032.      if (empty($this->priceRangeFrom)) {
  1033.          return $this->getPriceFrom();
  1034.      }
  1035.      return $this->priceRangeFrom;
  1036.  }
  1037.     #[Pure]
  1038.  public function getPriceRangeTo(): float
  1039.  {
  1040.      if (empty($this->priceRangeTo)) {
  1041.          return $this->getPriceTo();
  1042.      }
  1043.      return $this->priceRangeTo;
  1044.  }
  1045.     public function setUnpublished($unpublished): Parameter
  1046.     {
  1047.         $this->unpublished $unpublished;
  1048.         return $this;
  1049.     }
  1050.     public function getUnpublished(): bool
  1051.     {
  1052.         return $this->unpublished;
  1053.     }
  1054.     public function setExtendedResultset(bool $extendedResultset): self
  1055.     {
  1056.         $this->extendedResultset $extendedResultset;
  1057.         return $this;
  1058.     }
  1059.     public function getExtendedResultset(): bool
  1060.     {
  1061.         return $this->extendedResultset;
  1062.     }
  1063.     public function setMinPrice($minPrice): Parameter
  1064.     {
  1065.         $this->minPrice $minPrice;
  1066.         return $this;
  1067.     }
  1068.     public function getMinPrice(): int
  1069.     {
  1070.         return $this->minPrice;
  1071.     }
  1072.     public function getMinPriceBound(): float|int
  1073.     {
  1074.         return $this->minPriceBound;
  1075.     }
  1076.     public function getTopFirst(): ?int
  1077.     {
  1078.         return $this->topFirst;
  1079.     }
  1080.     public function setServiceCode(mixed $serviceCode): self
  1081.     {
  1082.         $this->serviceCode = (array)$serviceCode;
  1083.         return $this;
  1084.     }
  1085.     public function getServiceCode(): array
  1086.     {
  1087.         return $this->serviceCode;
  1088.     }
  1089.     public function getClassificationStarsOperator(): string
  1090.     {
  1091.         return $this->classificationStarsOperator;
  1092.     }
  1093.     public function setNotBookOnly(bool $notBookOnly): self
  1094.     {
  1095.         $this->notBookOnly $notBookOnly;
  1096.         return $this;
  1097.     }
  1098.     public function getNotBookOnly(): ?bool
  1099.     {
  1100.         return $this->notBookOnly;
  1101.     }
  1102.     public function setCheckTestHotels(bool $checkTestHotels): self
  1103.     {
  1104.         $this->checkTestHotels $checkTestHotels;
  1105.         return $this;
  1106.     }
  1107.     public function getCheckTestHotels(): bool
  1108.     {
  1109.         return $this->checkTestHotels;
  1110.     }
  1111.     public function setIsCorridor(bool $isCorridor): self
  1112.     {
  1113.         $this->isCorridor $isCorridor;
  1114.         return $this;
  1115.     }
  1116.     public function getIsCorridor(): bool
  1117.     {
  1118.         return $this->isCorridor;
  1119.     }
  1120.     public function setIsAlternative(bool $isAlternative): self
  1121.     {
  1122.         $this->isAlternative $isAlternative;
  1123.         return $this;
  1124.     }
  1125.     public function getIsAlternative(): bool
  1126.     {
  1127.         return $this->isAlternative;
  1128.     }
  1129.     public function setPreviousResults(int $previousResults): self
  1130.     {
  1131.         $this->previousResults $previousResults;
  1132.         return $this;
  1133.     }
  1134.     public function getPreviousResults(): int
  1135.     {
  1136.         return $this->previousResults;
  1137.     }
  1138.     public function setNights(array $nights): self
  1139.     {
  1140.         $this->nights $nights;
  1141.         return $this;
  1142.     }
  1143.     public function getNights(): array
  1144.     {
  1145.         return $this->nights;
  1146.     }
  1147.     public function setProductIds(mixed $productIds): self
  1148.     {
  1149.         $ints = [];
  1150.         foreach ((array)$productIds as $productId) {
  1151.             $ints[] = (int)$productId;
  1152.         }
  1153.         $this->productIds $ints;
  1154.         return $this;
  1155.     }
  1156.     public function getProductIds(): ?array
  1157.     {
  1158.         return $this->productIds;
  1159.     }
  1160.     public function getMinRatingCountForSort(): int
  1161.     {
  1162.         return $this->minRatingCountForSort;
  1163.     }
  1164.     public function getSkipBaseFilter(): bool
  1165.     {
  1166.         return $this->skipBaseFilter;
  1167.     }
  1168.     public function setCalculateStandardPrice(bool $calculateStandardPrice): self
  1169.     {
  1170.         $this->calculateStandardPrice $calculateStandardPrice;
  1171.         return $this;
  1172.     }
  1173.     public function getCalculateStandardPrice(): bool
  1174.     {
  1175.         return $this->calculateStandardPrice;
  1176.     }
  1177.     public function getFacilityGroup(): array
  1178.     {
  1179.         //dummy return value
  1180.         return [];
  1181.     }
  1182.     public function setParameterFromMixedObjects(array $filterObjects): static
  1183.     {
  1184.         foreach ($filterObjects as $obj) {
  1185.             // set all Towns from region
  1186.             if ($obj instanceof Region) {
  1187.                 $currentFilters $this->getTowns();
  1188.                 foreach ($obj->getChildren() as $town) {
  1189.                     if ($town instanceof Town) {
  1190.                         $currentFilters[] = $town->getId();
  1191.                     }
  1192.                 }
  1193.                 $this->setTowns($currentFilters);
  1194.                 continue;
  1195.             }
  1196.             $class get_class($obj);
  1197.             $classArray explode('\\'$class);
  1198.             $setter 'set' end($classArray);
  1199.             $getter 'get' end($classArray);
  1200.             $ssetter 'set' end($classArray) . 's';
  1201.             $sgetter 'get' end($classArray) . 's';
  1202.             if (method_exists($this$getter) && method_exists($this$setter)) {
  1203.                 $currentFilters $this->$getter();
  1204.                 $currentFilters[] = $obj->getId();
  1205.                 $this->$setter($currentFilters);
  1206.             } elseif (method_exists($this$sgetter) && method_exists($this$ssetter)) {
  1207.                 $currentFilters $this->$sgetter();
  1208.                 $currentFilters[] = $obj->getId();
  1209.                 $this->$ssetter((array)$currentFilters);
  1210.             }
  1211.         }
  1212.         return $this;
  1213.     }
  1214.     public function setAccommodationServiceProvider(array $accoIds): Parameter
  1215.     {
  1216.         $this->setAccoIds($accoIds);
  1217.         return $this;
  1218.     }
  1219.     #[Pure]
  1220.  public function getAccommodationServiceProvider(): ?array
  1221.  {
  1222.      return $this->getAccoIds();
  1223.  }
  1224.     public function setAccommodationProducts($productIds): Parameter
  1225.     {
  1226.         $this->setProductIds($productIds);
  1227.         return $this;
  1228.     }
  1229.     #[Pure]
  1230.  public function getAccommodationProducts(): ?array
  1231.  {
  1232.      return $this->getProductIds();
  1233.  }
  1234.     public function setLanguage($language): self
  1235.     {
  1236.         $this->language $language;
  1237.         return $this;
  1238.     }
  1239.     public function getLanguage(): ?string
  1240.     {
  1241.         return $this->language;
  1242.     }
  1243.     public function setCategory($categories): Parameter
  1244.     {
  1245.         $cats = [];
  1246.         foreach ($categories as $cat) {
  1247.             if (empty($cat)) {
  1248.                 continue;
  1249.             }
  1250.             if ($cat instanceof AbstractObject) {
  1251.                 $cats[] = $cat->getId();
  1252.             } else {
  1253.                 $cats[] = $cat;
  1254.             }
  1255.         }
  1256.         $this->setCategories($cats);
  1257.         return $this;
  1258.     }
  1259.     #[Pure]
  1260.  public function getCategory(): array
  1261.  {
  1262.      return $this->getCategories();
  1263.  }
  1264.     public function setFacility($facilities): Parameter
  1265.     {
  1266.         $objs = [];
  1267.         foreach ($facilities as $obj) {
  1268.             if (empty($obj)) {
  1269.                 continue;
  1270.             }
  1271.             if ($obj instanceof AbstractObject) {
  1272.                 $objs[] = $obj->getId();
  1273.             } else {
  1274.                 $objs[] = $obj;
  1275.             }
  1276.         }
  1277.         $this->setFacilities($objs);
  1278.         return $this;
  1279.     }
  1280.     #[Pure]
  1281.  public function getFacility(): array
  1282.  {
  1283.      return $this->getFacilities();
  1284.  }
  1285.     public function setMealType($mealTypeId): Parameter
  1286.     {
  1287.         $this->setMealTypeId($mealTypeId);
  1288.         return $this;
  1289.     }
  1290.     #[Pure]
  1291.  public function getMealType(): ?string
  1292.  {
  1293.      return $this->getMealTypeId();
  1294.  }
  1295.     public function getFacilityCombinationOperator(): string
  1296.     {
  1297.         return $this->facilityCombinationOperator;
  1298.     }
  1299.     public function getUseMultiLineMerge(): ?bool
  1300.     {
  1301.         return $this->useMultiLineMerge;
  1302.     }
  1303.     public function setUseMultiLineMerge(bool $useMultiLineMerge): self
  1304.     {
  1305.         $this->useMultiLineMerge $useMultiLineMerge;
  1306.         return $this;
  1307.     }
  1308.     public function getRoomFacilities(): array
  1309.     {
  1310.         return $this->roomFacilities;
  1311.     }
  1312.     public function setRoomFacilities(mixed $roomFacilities): self
  1313.     {
  1314.         //check if empty
  1315.         $tmp = [];
  1316.         if (is_array($roomFacilities)) {
  1317.             foreach ($roomFacilities as $roomFacility) {
  1318.                 if (!empty($roomFacility)) {
  1319.                     $tmp[] = $roomFacility;
  1320.                 }
  1321.             }
  1322.         } elseif (!empty($roomFacilities)) {
  1323.             $tmp[] = (int)$roomFacilities;
  1324.         }
  1325.         $this->roomFacilities $tmp;
  1326.         return $this;
  1327.     }
  1328.     public function getApartmentFacilities(): array
  1329.     {
  1330.         return $this->apartmentFacilities;
  1331.     }
  1332.     public function setApartmentFacilities(mixed $apartmentFacilities): self
  1333.     {
  1334.         //check if empty
  1335.         $tmp = [];
  1336.         if (is_array($apartmentFacilities)) {
  1337.             foreach ($apartmentFacilities as $apartmentFacility) {
  1338.                 if (!empty($apartmentFacility)) {
  1339.                     $tmp[] = $apartmentFacility;
  1340.                 }
  1341.             }
  1342.         } elseif (!empty($apartmentFacilities)) {
  1343.             $tmp[] = (int)$apartmentFacilities;
  1344.         }
  1345.         $this->apartmentFacilities $tmp;
  1346.         return $this;
  1347.     }
  1348.     public function getExcludeAccoIds(): ?array
  1349.     {
  1350.         return $this->excludeAccoIds;
  1351.     }
  1352.     public function setExcludeAccoIds(array $excludeAccoIds): self
  1353.     {
  1354.         $this->excludeAccoIds $excludeAccoIds;
  1355.         return $this;
  1356.     }
  1357.     public function getPriority(): ?int
  1358.     {
  1359.         return $this->priority;
  1360.     }
  1361.     public function setPriority(int $priority): self
  1362.     {
  1363.         $this->priority $priority;
  1364.         return $this;
  1365.     }
  1366.     public function getPriorityOperator(): string
  1367.     {
  1368.         return $this->priorityOperator;
  1369.     }
  1370.     public function isSpecialsOnly(): mixed
  1371.     {
  1372.         return $this->specialsOnly;
  1373.     }
  1374.     public function setSpecialsOnly(mixed $specialsOnly): self
  1375.     {
  1376.         $this->specialsOnly $specialsOnly;
  1377.         return $this;
  1378.     }
  1379.     public function isBestpriceOnly(): bool
  1380.     {
  1381.         return $this->bestpriceOnly;
  1382.     }
  1383.     public function setBestpriceOnly(bool $bestpriceOnly): self
  1384.     {
  1385.         $this->bestpriceOnly $bestpriceOnly;
  1386.         return $this;
  1387.     }
  1388.     public function isBestpriceProvider(): mixed
  1389.     {
  1390.         return $this->bestpriceProvider;
  1391.     }
  1392.     public function setBestpriceProvider(mixed $bestpriceProvider): self
  1393.     {
  1394.         $this->bestpriceProvider $bestpriceProvider;
  1395.         return $this;
  1396.     }
  1397.     public function getSpecialsOperator(): string
  1398.     {
  1399.         return $this->specialsOperator;
  1400.     }
  1401.     public function getAllTopsFirst(): bool
  1402.     {
  1403.         return $this->allTopsFirst;
  1404.     }
  1405.     public function isTicketingOnly(): ?bool
  1406.     {
  1407.         return $this->ticketingOnly;
  1408.     }
  1409.     public function getStarsTableNeeded(): bool
  1410.     {
  1411.         return $this->starsTableNeeded;
  1412.     }
  1413.     public function setStarsTableNeeded(bool $starsTableNeeded): self
  1414.     {
  1415.         $this->starsTableNeeded $starsTableNeeded;
  1416.         return $this;
  1417.     }
  1418.     public function getSpecialSpecific(): array
  1419.     {
  1420.         return $this->specialSpecific;
  1421.     }
  1422.     public function setSpecialSpecific(array $specialSpecific): ?self
  1423.     {
  1424.         if (!empty($this->getExcludeSpecialSpecific())) {
  1425.             return null;
  1426.         }
  1427.         $this->specialSpecific $specialSpecific;
  1428.         return $this;
  1429.     }
  1430.     public function getExcludeSpecialSpecific(): array
  1431.     {
  1432.         return $this->excludeSpecialSpecific;
  1433.     }
  1434.     public function setExcludeSpecialSpecific(mixed $excludeSpecialSpecific): ?self
  1435.     {
  1436.         if (!empty($this->getSpecialSpecific())) {
  1437.             return null;
  1438.         }
  1439.         if (!is_array($excludeSpecialSpecific)) {
  1440.             $excludeSpecialSpecific = [$excludeSpecialSpecific];
  1441.         }
  1442.         $this->excludeSpecialSpecific $excludeSpecialSpecific;
  1443.         return $this;
  1444.     }
  1445.     public function getFreeCancellation(): bool
  1446.     {
  1447.         return $this->freeCancellation;
  1448.     }
  1449.     public function setFreeCancellation(bool $freeCancellation): void
  1450.     {
  1451.         $this->freeCancellation $freeCancellation;
  1452.     }
  1453.     public function getContentScore(): int
  1454.     {
  1455.         return $this->contentScore;
  1456.     }
  1457.     public function setContentScore(int $contentScore): void
  1458.     {
  1459.         $this->contentScore $contentScore;
  1460.     }
  1461.     public function setBookOnRequestAsBookable(bool $bookOnRequestAsBookable): void
  1462.     {
  1463.         $this->bookOnRequestAsBookable $bookOnRequestAsBookable;
  1464.     }
  1465. }