src/Controller/ProfileListController.php line 442

Open in your IDE?
  1. <?php
  2. /**
  3.  * Created by simpson <simpsonwork@gmail.com>
  4.  * Date: 2019-03-19
  5.  * Time: 22:28
  6.  */
  7. namespace App\Controller;
  8. use App\Bridge\Porpaginas\Doctrine\ORM\FakeORMQueryPage;
  9. use App\Entity\Location\City;
  10. use App\Entity\Location\County;
  11. use App\Entity\Location\District;
  12. use App\Entity\Location\Station;
  13. use App\Entity\Profile\BodyTypes;
  14. use App\Entity\Profile\BreastTypes;
  15. use App\Entity\Profile\Genders;
  16. use App\Entity\Profile\HairColors;
  17. use App\Entity\Profile\Nationalities;
  18. use App\Entity\Profile\PrivateHaircuts;
  19. use App\Entity\Service;
  20. use App\Entity\ServiceGroups;
  21. use App\Entity\TakeOutLocations;
  22. use App\Repository\ServiceRepository;
  23. use App\Repository\StationRepository;
  24. use App\Service\CountryCurrencyResolver;
  25. use App\Service\DefaultCityProvider;
  26. use App\Service\Features;
  27. use App\Service\HomepageCityListingsBlockProvider;
  28. use App\Service\ListingRotationApi;
  29. use App\Service\ListingService;
  30. use App\Service\ProfileList;
  31. use App\Service\ProfileListingRecommendationsFiller;
  32. use App\Service\ProfileListingDataCreator;
  33. use App\Service\ProfileListSpecificationService;
  34. use App\Service\ProfileFilterService;
  35. use App\Service\ProfileTopBoard;
  36. use App\Service\Top100ProfilesService;
  37. use App\Specification\ElasticSearch\ISpecification;
  38. use App\Specification\Profile\ProfileHasApartments;
  39. use App\Specification\Profile\ProfileIdINOrderedByINValues;
  40. use App\Specification\Profile\ProfileIsElite;
  41. use App\Specification\Profile\ProfileIsLocated;
  42. use App\Specification\Profile\ProfileIsProvidingOneOfServices;
  43. use App\Specification\Profile\ProfileIsProvidingTakeOut;
  44. use App\Specification\Profile\ProfilePriceThresholds;
  45. use App\Specification\Profile\ProfileWithAge;
  46. use App\Specification\Profile\ProfileWithBodyType;
  47. use App\Specification\Profile\ProfileWithBreastType;
  48. use App\Specification\Profile\ProfileWithHairColor;
  49. use App\Specification\Profile\ProfileWithNationality;
  50. use App\Specification\Profile\ProfileWithPrivateHaircut;
  51. use Flagception\Bundle\FlagceptionBundle\Annotations\Feature;
  52. use Happyr\DoctrineSpecification\Filter\Filter;
  53. use Happyr\DoctrineSpecification\Logic\OrX;
  54. use OpenApi\Attributes as OA;
  55. use Porpaginas\Doctrine\ORM\ORMQueryResult;
  56. use Porpaginas\Page;
  57. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache;
  58. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Entity;
  59. use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
  60. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  61. use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
  62. use Symfony\Component\HttpFoundation\Request;
  63. use Happyr\DoctrineSpecification\Spec;
  64. use Symfony\Component\HttpFoundation\RequestStack;
  65. use Symfony\Component\HttpFoundation\Response;
  66. use Symfony\Component\Routing\Annotation\Route;
  67. /**
  68.  * @see \App\Console\Export\ExportRotationListingsConfigCommand for listing API endpoints
  69.  */
  70. #[Cache(maxage60, public: true)]
  71. class ProfileListController extends AbstractController
  72. {
  73.     use ExtendedPaginationTrait;
  74.     use SpecTrait;
  75.     use ProfileMinPriceTrait;
  76.     use ResponseTrait;
  77.     const ENTRIES_ON_PAGE 36;
  78.     const RESULT_SOURCE_COUNTY 'county';
  79.     const RESULT_SOURCE_DISTRICT 'district';
  80.     const RESULT_SOURCE_STATION 'station';
  81.     const RESULT_SOURCE_APPROVED 'approved';
  82.     const RESULT_SOURCE_WITH_COMMENTS 'with_comments';
  83.     const RESULT_SOURCE_WITH_VIDEO 'with_video';
  84.     const RESULT_SOURCE_WITH_SELFIE 'with_selfie';
  85.     const RESULT_SOURCE_TOP_100 'top_100';
  86.     const RESULT_SOURCE_ELITE 'elite';
  87.     const RESULT_SOURCE_MASSEURS 'masseurs';
  88.     const RESULT_SOURCE_MASSAGE_SERVICE 'massage_service';
  89.     const RESULT_SOURCE_BY_PARAMS 'by_params';
  90.     const RESULT_SOURCE_SERVICE 'service';
  91.     const RESULT_SOURCE_CITY 'city';
  92.     const RESULT_SOURCE_COUNTRY 'country';
  93.     const RESULT_SOURCE_WITH_WHATSAPP 'with_whatsapp';
  94.     const RESULT_SOURCE_WITH_TELEGRAM 'with_telegram';
  95.     const RESULT_SOURCE_EIGHTEEN_YEARS_OLD 'eighteen_years_old';
  96.     const RESULT_SOURCE_BIG_ASS 'big_ass';
  97.     const RESULT_SOURCE_WITH_TATTOO 'with_tattoo';
  98.     const RESULT_SOURCE_WITH_PIERCING 'with_piercing';
  99.     const RESULT_SOURCE_ROUND_THE_CLOCK 'round_the_clock';
  100.     const RESULT_SOURCE_FOR_TWO_HOURS 'for_two_hours';
  101.     const RESULT_SOURCE_FOR_HOUR 'for_hour';
  102.     const RESULT_SOURCE_EXPRESS_PROGRAM 'express_program';
  103.     const RESULT_SOURCE_EROMASSAGE 'eromassage';
  104.     const RESULT_SOURCE_VERIFIED 'verified';
  105.     const RESULT_SOURCE_CHEAP 'cheap';
  106.     const RESULT_SOURCE_MATURE 'mature';
  107.     const RESULT_SOURCE_UZBEK 'uzbek';
  108.     private ?string $source null;
  109.     public function __construct(
  110.         private RequestStack $requestStack,
  111.         private ProfileList                     $profileList,
  112.         private CountryCurrencyResolver         $countryCurrencyResolver,
  113.         private ServiceRepository               $serviceRepository,
  114.         private ListingService                  $listingService,
  115.         private Features                        $features,
  116.         private ProfileFilterService            $profilesFilterService,
  117.         private ProfileListSpecificationService $profileListSpecificationService,
  118.         private ProfileListingDataCreator       $profileListingDataCreator,
  119.         private Top100ProfilesService           $top100ProfilesService,
  120.         private ParameterBagInterface           $parameterBag,
  121.         private ListingRotationApi              $listingRotationApi,
  122.         private ProfileTopBoard                 $profileTopBoard,
  123.         private HomepageCityListingsBlockProvider $homepageCityListingsBlockProvider,
  124.         private ProfileListingRecommendationsFiller $profileListingRecommendationsFiller,
  125.     ) {}
  126.     /**
  127.      * @Feature("has_masseurs")
  128.      */
  129.     #[ParamConverter("city"converter"city_converter")]
  130.     #[Route("/api/profiles/listing/city/{city}/masseur"name"api.profile_listing.masseur"methods"GET"format"json")]
  131.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  132.     #[OA\Tag(name"ProfileListing")]
  133.     #[OA\Response(
  134.         response200,
  135.         description'',
  136.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  137.     )]
  138.     public function listForMasseur(Request $requestCity $cityServiceRepository $serviceRepository): Response
  139.     {
  140.         $specs $this->profileListSpecificationService->listForMasseur($city);
  141.         $response = new Response();
  142.         $massageGroupServices $serviceRepository->findBy(['group' => ServiceGroups::MASSAGE]);
  143.         $alternativeSpec $this->getORSpecForItemsArray([$massageGroupServices], function($item): ProfileIsProvidingOneOfServices {
  144.             return new ProfileIsProvidingOneOfServices($item);
  145.         });
  146.         $result $this->paginatedListing($city'/city/{city}/masseur', ['city' => $city->getId()], $specs->spec(), $alternativeSpecself::RESULT_SOURCE_MASSAGE_SERVICE$response);
  147.         if ($this->isApiRequest($request)) {
  148.             return $this->json($result);
  149.         }
  150.         return $this->render('ProfileList/list.html.twig', [
  151.             'profiles' => $result,
  152.             'source' => $this->source,
  153.             'source_default' => self::RESULT_SOURCE_MASSEURS,
  154.             'recommendationSpec' => $specs->recommendationSpec(),
  155.         ], response$response);
  156.     }
  157.     /**
  158.      * @Feature("extra_category_big_ass")
  159.      */
  160.     #[ParamConverter("city"converter"city_converter")]
  161.     #[Route("/api/profiles/listing/city/{city}/category/big_ass"name"api.profile_listing.category.big_ass"methods"GET"format"json")]
  162.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  163.     #[OA\Tag(name"ProfileListing")]
  164.     #[OA\Response(
  165.         response200,
  166.         description'',
  167.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  168.     )]
  169.     public function listBigAss(Request $requestCity $city): Response
  170.     {
  171.         $specs $this->profileListSpecificationService->listBigAss();
  172.         $response = new Response();
  173.         $result $this->paginatedListing($city'/city/{city}/category/big_ass', ['city' => $city->getId()], $specs->spec(), nullnull$response);
  174.         if ($this->isApiRequest($request)) {
  175.             return $this->json($result);
  176.         }
  177.         return $this->render('ProfileList/list.html.twig', [
  178.             'profiles' => $result,
  179.             'source' => $this->source,
  180.             'source_default' => self::RESULT_SOURCE_BIG_ASS,
  181.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  182.                 'city' => $city->getUriIdentity(),
  183.                 'page' => $this->getCurrentPageNumber(),
  184.             ]),
  185.             'recommendationSpec' => $specs->recommendationSpec(),
  186.         ], response$response);
  187.     }
  188.     public function listByDefaultCity(ParameterBagInterface $parameterBagRequest $request): Response
  189.     {
  190.         $controller get_class($this).'::listByCity';
  191.         $path = [
  192.             'city' => $parameterBag->get('default_city'),
  193.             'subRequest' => true,
  194.         ];
  195.         //чтобы в обработчике можно было понять, по какому роуту зашли
  196.         $request->request->set('_route''profile_list.list_by_city');
  197.         return $this->forward($controller$path);
  198.     }
  199.     private function paginatedListing(City $city, ?string $apiEndpoint, array $apiParams, ?Filter $listingSpec null, ?OrX $alternativeSpec null, ?string $alternativeSource null, ?Response $response null): Page
  200.     {
  201.         $topPlacement $this->profileTopBoard->topPlacementSatisfiedBy($city$listingSpec);
  202.         $topPlacement?->setTopCard(); // mark as top card for UI
  203.         $page $this->getCurrentPageNumber();
  204.         $apiParams['city'] = $city->getId();
  205.         try {
  206.             if (null === $apiEndpoint) {
  207.                 throw new \RuntimeException('Empty API endpoint to switch to legacy listing query.');
  208.             }
  209.             $result $this->listingRotationApi->paginate($apiEndpoint$apiParams$page$topPlacement);
  210.             $response?->setMaxAge(10);
  211.         } catch (\Exception) {
  212.             $avoidOrTopPlacement = (null !== $topPlacement && $page 2) ? $topPlacement null;
  213.             $result $this->profileList->list($citynull$listingSpec, [], truenullProfileList::ORDER_BY_STATUS,
  214.                 nulltruenull, [Genders::FEMALE], $avoidOrTopPlacement);
  215.         }
  216.         return $result;
  217.     }
  218.     #[ParamConverter("city"converter"city_converter")]
  219.     #[Route("/api/profiles/listing/city/{city}"name"api.profile_listing.by_city"methods"GET"format"json")]
  220.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  221.     #[OA\Tag(name"ProfileListing")]
  222.     #[OA\Response(
  223.         response200,
  224.         description'Листинг анкет по городу',
  225.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  226.     )]
  227.     public function listByCity(ParameterBagInterface $parameterBagRequest $requestCity $citybool $subRequest false): Response
  228.     {
  229.         $page $this->getCurrentPageNumber();
  230.         if ($this->features->redirect_default_city_to_homepage() && false === $subRequest && $city->equals($parameterBag->get('default_city')) && $page 2) {
  231.             return $this->redirectToRoute('homepage', [], 301);
  232.         }
  233.         $specs $this->profileListSpecificationService->listByCity();
  234.         $response = new Response();
  235.         $result $this->paginatedListing($city'/city/{city}', ['city' => $city->getId()], $specs->spec(), nullnull$response);
  236.         if ($this->isApiRequest($request)) {
  237.             return $this->json($result);
  238.         }
  239.         $homepageCityListingsBlock null;
  240.         if ($this->shouldShowHomepageCityListingsBlock($city$page$subRequest)) {
  241.             $homepageCityListingsBlock $this->homepageCityListingsBlockProvider->getForCity($city);
  242.         }
  243.         return $this->render('ProfileList/list.html.twig', [
  244.             'profiles' => $result,
  245.             'homepage_city_listings_block' => $homepageCityListingsBlock,
  246.             'recommendationSpec' => $specs->recommendationSpec(),
  247.         ], response$response);
  248.     }
  249.     /**
  250.      * @Feature("intim_moscow_listing")
  251.      */
  252.     #[Cache(maxage3600, public: true)]
  253.     #[Route("/api/profiles/listing/city/{city}/intim"name"api.profile_listing.intim"methods"GET"format"json")]
  254.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  255.     #[OA\Tag(name"ProfileListing")]
  256.     #[OA\Response(
  257.         response200,
  258.         description'',
  259.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  260.     )]
  261.     public function listIntim(Request $requestDefaultCityProvider $defaultCityProvider): Response
  262.     {
  263.         $city $defaultCityProvider->getDefaultCity();
  264.         $request->attributes->set('city'$city);
  265.         $specs $this->profileListSpecificationService->listByCity();
  266.         $response = new Response();
  267.         $result $this->paginatedListing($city'/city/{city}/intim', ['city' => $city->getId()], $specs->spec(), nullnull$response);
  268.         $result $this->shuffleProfilesOnPage($result);
  269.         $response->setMaxAge(3600);
  270.         if ($this->isApiRequest($request)) {
  271.             return $this->json($result);
  272.         }
  273.         return $this->render('ProfileList/list.html.twig', [
  274.             'profiles' => $result,
  275.             'city' => $city,
  276.             'recommendationSpec' => $specs->recommendationSpec(),
  277.         ], response$response);
  278.     }
  279.     #[ParamConverter("city"converter"city_converter")]
  280.     #[Entity("county"expr"repository.ofUriIdentityWithinCity(county, city)")]
  281.     #[Route("/api/profiles/listing/city/{city}/county/{county}"name"api.profile_listing.by_county"methods"GET"format"json")]
  282.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  283.     #[OA\Tag(name"ProfileListing")]
  284.     #[OA\Response(
  285.         response200,
  286.         description'',
  287.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  288.     )]
  289.     public function listByCounty(Request $requestCity $cityCounty $county): Response
  290.     {
  291.         if (!$city->hasCounty($county)) {
  292.             throw $this->createNotFoundException();
  293.         }
  294.         $specs $this->profileListSpecificationService->listByCounty($county);
  295.         $response = new Response();
  296.         $alternativeSpec Spec::orX(ProfileIsLocated::withinCounties($city$city->getCounties()->toArray()));
  297.         $result $this->paginatedListing($city'/city/{city}/county/{county}', ['city' => $city->getId(), 'county' => $county->getId()], $specs->spec(), $alternativeSpecself::RESULT_SOURCE_COUNTY$response);
  298.         if ($this->isApiRequest($request)) {
  299.             return $this->json($result);
  300.         }
  301.         return $this->render('ProfileList/list.html.twig', [
  302.             'profiles' => $result,
  303.             'source' => $this->source,
  304.             'source_default' => self::RESULT_SOURCE_COUNTY,
  305.             'county' => $county,
  306.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  307.                 'city' => $city->getUriIdentity(),
  308.                 'county' => $county->getUriIdentity(),
  309.                 'page' => $this->getCurrentPageNumber()
  310.             ]),
  311.             'recommendationSpec' => $specs->recommendationSpec(),
  312.         ], response$response);
  313.     }
  314.     #[ParamConverter("city"converter"city_converter")]
  315.     #[Entity("district"expr"repository.ofUriIdentityWithinCity(district, city)")]
  316.     #[Route("/api/profiles/listing/city/{city}/district/{district}"name"api.profile_listing.by_district"methods"GET"format"json")]
  317.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  318.     #[OA\Tag(name"ProfileListing")]
  319.     #[OA\Response(
  320.         response200,
  321.         description'',
  322.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  323.     )]
  324.     public function listByDistrict(Request $requestCity $cityDistrict $district): Response
  325.     {
  326.         if (!$city->hasDistrict($district)) {
  327.             throw $this->createNotFoundException();
  328.         }
  329.         $specs $this->profileListSpecificationService->listByDistrict($district);
  330.         $response = new Response();
  331.         $alternativeSpec Spec::orX(ProfileIsLocated::withinDistricts($city$city->getDistricts()->toArray()));
  332.         $result $this->paginatedListing($city'/city/{city}/district/{district}', ['city' => $city->getId(), 'district' => $district->getId()], $specs->spec(), $alternativeSpecself::RESULT_SOURCE_DISTRICT$response);
  333.         if ($this->isApiRequest($request)) {
  334.             return $this->json($result);
  335.         }
  336.         return $this->render('ProfileList/list.html.twig', [
  337.             'profiles' => $result,
  338.             'source' => $this->source,
  339.             'source_default' => self::RESULT_SOURCE_DISTRICT,
  340.             'district' => $district,
  341.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  342.                 'city' => $city->getUriIdentity(),
  343.                 'district' => $district->getUriIdentity(),
  344.                 'page' => $this->getCurrentPageNumber()
  345.             ]),
  346.             'recommendationSpec' => $specs->recommendationSpec(),
  347.         ], response$response);
  348.     }
  349.     /**
  350.      * @Feature("extra_category_without_prepayment")
  351.      */
  352.     #[ParamConverter("city"converter"city_converter")]
  353.     #[Route("/api/profiles/listing/city/{city}/category/without_prepayment"name"api.profile_listing.category.without_prepayment"methods"GET"format"json")]
  354.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  355.     #[OA\Tag(name"ProfileListing")]
  356.     #[OA\Response(
  357.         response200,
  358.         description'',
  359.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  360.     )]
  361.     public function listWithoutPrepayment(Request $requestCity $city): Response
  362.     {
  363.         $listingData $this->profileListingDataCreator->getListingDataForFilter('listWithoutPrepayment', [], $city);
  364.         $specs $listingData['specs'];
  365.         $listingTypeName $listingData['listingTypeName'];
  366.         $response = new Response();
  367.         $result $this->paginatedListing($city'/city/{city}/category/without_prepayment', ['city' => $city->getId()], $specs->spec(), nullnull$response);
  368.         if ($this->isApiRequest($request)) {
  369.             return $this->json($result);
  370.         }
  371.         $request->attributes->set('profiles_count'$result->totalCount());
  372.         $request->attributes->set('listingTypeName'$listingTypeName);
  373.         $request->attributes->set('city'$city);
  374.         return $this->render('ProfileList/list.html.twig', [
  375.             'profiles' => $result,
  376.             'source' => $this->source,
  377.             'source_default' => 'without_prepayment',
  378.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  379.                 'city' => $city->getUriIdentity(),
  380.                 'page' => $this->getCurrentPageNumber(),
  381.             ]),
  382.             'recommendationSpec' => $specs->recommendationSpec(),
  383.         ], response$response);
  384.     }
  385.     #[ParamConverter("city"converter"city_converter")]
  386.     #[Entity("station"expr"repository.ofUriIdentityWithinCity(station, city)")]
  387.     #[Route("/api/profiles/listing/city/{city}/station/{station}"name"api.profile_listing.by_station"methods"GET"format"json")]
  388.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  389.     #[OA\Tag(name"ProfileListing")]
  390.     #[OA\Response(
  391.         response200,
  392.         description'',
  393.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  394.     )]
  395.     public function listByStation(Request $requestCity $cityStation $station): Response
  396.     {
  397.         if (!$city->hasStation($station)) {
  398.             throw $this->createNotFoundException();
  399.         }
  400.         $specs $this->profileListSpecificationService->listByStation($station);
  401.         $response = new Response();
  402.         $result $this->paginatedListing($city'/city/{city}/station/{station}', ['city' => $city->getId(), 'station' => $station->getId()], $specs->spec(), nullnull$response);
  403.         if ($this->isApiRequest($request)) {
  404.             return $this->json($result);
  405.         }
  406.         return $this->render('ProfileList/list.html.twig', [
  407.             'profiles' => $result,
  408.             'source' => $this->source,
  409.             'source_default' => self::RESULT_SOURCE_STATION,
  410.             'station' => $station,
  411.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  412.                 'city' => $city->getUriIdentity(),
  413.                 'station' => $station->getUriIdentity(),
  414.                 'page' => $this->getCurrentPageNumber()
  415.             ]),
  416.             'recommendationSpec' => $specs->recommendationSpec(),
  417.         ], response$response);
  418.     }
  419.     #[ParamConverter("city"converter"city_converter")]
  420.     public function listByStations(City $citystring $stationsStationRepository $stationRepository): Response
  421.     {
  422.         $stationIds explode(','$stations);
  423.         $stations $stationRepository->findBy(['uriIdentity' => $stationIds]);
  424.         $specs $this->profileListSpecificationService->listByStations($stations);
  425.         $response = new Response();
  426.         $result $this->paginatedListing($citynull, [], $specs->spec(), nullnull$response);
  427.         return $this->render('ProfileList/list.html.twig', [
  428.             'profiles' => $result,
  429.             'recommendationSpec' => $specs->recommendationSpec(),
  430.         ]);
  431.     }
  432.     #[ParamConverter("city"converter"city_converter")]
  433.     #[Route("/api/profiles/listing/city/{city}/approved"name"api.profile_listing.approved"methods"GET"format"json")]
  434.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  435.     #[OA\Tag(name"ProfileListing")]
  436.     #[OA\Response(
  437.         response200,
  438.         description'',
  439.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  440.     )]
  441.     public function listApproved(Request $requestCity $city): Response
  442.     {
  443.         $specs $this->profileListSpecificationService->listApproved();
  444.         $response = new Response();
  445.         $result $this->paginatedListing($city'/city/{city}/approved', ['city' => $city->getId()], $specs->spec(), nullnull$response);
  446.         if ($this->isApiRequest($request)) {
  447.             return $this->json($result);
  448.         }
  449.         return $this->render('ProfileList/list.html.twig', [
  450.             'profiles' => $result,
  451.             'source' => $this->source,
  452.             'source_default' => self::RESULT_SOURCE_APPROVED,
  453.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  454.                 'city' => $city->getUriIdentity(),
  455.                 'page' => $this->getCurrentPageNumber()
  456.             ]),
  457.             'recommendationSpec' => $specs->recommendationSpec(),
  458.         ], response$response);
  459.     }
  460.     /**
  461.      * @Feature("extra_category_with_whatsapp")
  462.      */
  463.     #[ParamConverter("city"converter"city_converter")]
  464.     #[Route("/api/profiles/listing/city/{city}/category/whatsapp"name"api.profile_listing.category.whatsapp"methods"GET"format"json")]
  465.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  466.     #[OA\Tag(name"ProfileListing")]
  467.     #[OA\Response(
  468.         response200,
  469.         description'',
  470.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  471.     )]
  472.     public function listWithWhatsapp(Request $requestCity $city): Response
  473.     {
  474.         $specs $this->profileListSpecificationService->listWithWhatsapp();
  475.         $response = new Response();
  476.         $result $this->paginatedListing($city'/city/{city}/category/whatsapp', ['city' => $city->getId()], $specs->spec(), nullnull$response);
  477.         if ($this->isApiRequest($request)) {
  478.             return $this->json($result);
  479.         }
  480.         return $this->render('ProfileList/list.html.twig', [
  481.             'profiles' => $result,
  482.             'source' => $this->source,
  483.             'source_default' => self::RESULT_SOURCE_WITH_WHATSAPP,
  484.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  485.                 'city' => $city->getUriIdentity(),
  486.                 'page' => $this->getCurrentPageNumber(),
  487.             ]),
  488.             'recommendationSpec' => $specs->recommendationSpec(),
  489.         ], response$response);
  490.     }
  491.     /**
  492.      * @Feature("extra_category_with_telegram")
  493.      */
  494.     #[ParamConverter("city"converter"city_converter")]
  495.     #[Route("/api/profiles/listing/city/{city}/category/telegram"name"api.profile_listing.category.telegram"methods"GET"format"json")]
  496.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  497.     #[OA\Tag(name"ProfileListing")]
  498.     #[OA\Response(
  499.         response200,
  500.         description'',
  501.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  502.     )]
  503.     public function listWithTelegram(Request $requestCity $city): Response
  504.     {
  505.         $specs $this->profileListSpecificationService->listWithTelegram();
  506.         $response = new Response();
  507.         $result $this->paginatedListing($city'/city/{city}/category/telegram', ['city' => $city->getId()], $specs->spec(), nullnull$response);
  508.         if ($this->isApiRequest($request)) {
  509.             return $this->json($result);
  510.         }
  511.         return $this->render('ProfileList/list.html.twig', [
  512.             'profiles' => $result,
  513.             'source' => $this->source,
  514.             'source_default' => self::RESULT_SOURCE_WITH_TELEGRAM,
  515.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  516.                 'city' => $city->getUriIdentity(),
  517.                 'page' => $this->getCurrentPageNumber(),
  518.             ]),
  519.             'recommendationSpec' => $specs->recommendationSpec(),
  520.         ], response$response);
  521.     }
  522.     /**
  523.      * @Feature("extra_category_eighteen_years_old")
  524.      */
  525.     #[ParamConverter("city"converter"city_converter")]
  526.     #[Route("/api/profiles/listing/city/{city}/category/eighteen_years_old"name"api.profile_listing.category.eighteen_years_old"methods"GET"format"json")]
  527.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  528.     #[OA\Tag(name"ProfileListing")]
  529.     #[OA\Response(
  530.         response200,
  531.         description'',
  532.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  533.     )]
  534.     public function listEighteenYearsOld(Request $requestCity $city): Response
  535.     {
  536.         $specs $this->profileListSpecificationService->listEighteenYearsOld();
  537.         $response = new Response();
  538.         $result $this->paginatedListing($city'/city/{city}/category/eighteen_years_old', ['city' => $city->getId()], $specs->spec(), nullnull$response);
  539.         if ($this->isApiRequest($request)) {
  540.             return $this->json($result);
  541.         }
  542.         return $this->render('ProfileList/list.html.twig', [
  543.             'profiles' => $result,
  544.             'source' => $this->source,
  545.             'source_default' => self::RESULT_SOURCE_EIGHTEEN_YEARS_OLD,
  546.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  547.                 'city' => $city->getUriIdentity(),
  548.                 'page' => $this->getCurrentPageNumber(),
  549.             ]),
  550.             'recommendationSpec' => $specs->recommendationSpec(),
  551.         ], response$response);
  552.     }
  553.     /**
  554.      * @Feature("extra_category_rublevskie")
  555.      */
  556.     #[ParamConverter("city"converter"city_converter")]
  557.     #[Route("/api/profiles/listing/city/{city}/category/rublevskie"name"api.profile_listing.category.rublevskie"methods"GET"format"json")]
  558.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  559.     #[OA\Tag(name"ProfileListing")]
  560.     #[OA\Response(
  561.         response200,
  562.         description'',
  563.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  564.     )]
  565.     public function listRublevskie(Request $requestCity $city): Response
  566.     {
  567.         if ($city->getUriIdentity() !== 'moscow') {
  568.             throw $this->createNotFoundException();
  569.         }
  570.         $specs $this->profileListSpecificationService->listRublevskie($city);
  571.         $response = new Response();
  572.         $result $this->paginatedListing($city'/city/{city}/category/rublevskie', ['city' => $city->getId()], $specs->spec(), nullnull$response);
  573.         if ($this->isApiRequest($request)) {
  574.             return $this->json($result);
  575.         }
  576.         return $this->render('ProfileList/list.html.twig', [
  577.             'profiles' => $result,
  578.             'source' => $this->source,
  579.             'source_default' => 'rublevskie',
  580.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  581.                 'city' => $city->getUriIdentity(),
  582.                 'page' => $this->getCurrentPageNumber(),
  583.             ]),
  584.             'recommendationSpec' => $specs->recommendationSpec(),
  585.         ], response$response);
  586.     }
  587.     /**
  588.      * @Feature("extra_category_with_tattoo")
  589.      */
  590.     #[ParamConverter("city"converter"city_converter")]
  591.     #[Route("/api/profiles/listing/city/{city}/category/with_tattoo"name"api.profile_listing.category.with_tattoo"methods"GET"format"json")]
  592.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  593.     #[OA\Tag(name"ProfileListing")]
  594.     #[OA\Response(
  595.         response200,
  596.         description'',
  597.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  598.     )]
  599.     public function listWithTattoo(Request $requestCity $city): Response
  600.     {
  601.         $specs $this->profileListSpecificationService->listWithTattoo();
  602.         $response = new Response();
  603.         $result $this->paginatedListing($city'/city/{city}/category/with_tattoo', ['city' => $city->getId()], $specs->spec(), nullnull$response);
  604.         if ($this->isApiRequest($request)) {
  605.             return $this->json($result);
  606.         }
  607.         return $this->render('ProfileList/list.html.twig', [
  608.             'profiles' => $result,
  609.             'source' => $this->source,
  610.             'source_default' => self::RESULT_SOURCE_WITH_TATTOO,
  611.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  612.                 'city' => $city->getUriIdentity(),
  613.                 'page' => $this->getCurrentPageNumber(),
  614.             ]),
  615.             'recommendationSpec' => $specs->recommendationSpec(),
  616.         ], response$response);
  617.     }
  618.     #[ParamConverter("city"converter"city_converter")]
  619.     #[Route("/api/profiles/listing/city/{city}/with_comments"name"api.profile_listing.with_comments"methods"GET"format"json")]
  620.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  621.     #[OA\Tag(name"ProfileListing")]
  622.     #[OA\Response(
  623.         response200,
  624.         description'',
  625.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  626.     )]
  627.     public function listWithComments(Request $requestCity $city): Response
  628.     {
  629.         $specs $this->profileListSpecificationService->listWithComments();
  630.         $response = new Response();
  631.         $result $this->paginatedListing($city'/city/{city}/with_comments', ['city' => $city->getId()], $specs->spec(), nullnull$response);
  632.         if ($this->isApiRequest($request)) {
  633.             return $this->json($result);
  634.         }
  635.         return $this->render('ProfileList/list.html.twig', [
  636.             'profiles' => $result,
  637.             'source' => $this->source,
  638.             'source_default' => self::RESULT_SOURCE_WITH_COMMENTS,
  639.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  640.                 'city' => $city->getUriIdentity(),
  641.                 'page' => $this->getCurrentPageNumber()
  642.             ]),
  643.             'recommendationSpec' => $specs->recommendationSpec(),
  644.         ], response$response);
  645.     }
  646.     /**
  647.      * @Feature("extra_category_with_piercing")
  648.      */
  649.     #[ParamConverter("city"converter"city_converter")]
  650.     #[Route("/api/profiles/listing/city/{city}/category/with_piercing"name"api.profile_listing.category.with_piercing"methods"GET"format"json")]
  651.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  652.     #[OA\Tag(name"ProfileListing")]
  653.     #[OA\Response(
  654.         response200,
  655.         description'',
  656.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  657.     )]
  658.     public function listWithPiercing(Request $requestCity $city): Response
  659.     {
  660.         $specs $this->profileListSpecificationService->listWithPiercing();
  661.         $response = new Response();
  662.         $result $this->paginatedListing($city'/city/{city}/category/with_piercing', ['city' => $city->getId()], $specs->spec(), nullnull$response);
  663.         if ($this->isApiRequest($request)) {
  664.             return $this->json($result);
  665.         }
  666.         return $this->render('ProfileList/list.html.twig', [
  667.             'profiles' => $result,
  668.             'source' => $this->source,
  669.             'source_default' => self::RESULT_SOURCE_WITH_PIERCING,
  670.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  671.                 'city' => $city->getUriIdentity(),
  672.                 'page' => $this->getCurrentPageNumber(),
  673.             ]),
  674.             'recommendationSpec' => $specs->recommendationSpec(),
  675.         ], response$response);
  676.     }
  677.     #[ParamConverter("city"converter"city_converter")]
  678.     #[Route("/api/profiles/listing/city/{city}/with_video"name"api.profile_listing.with_video"methods"GET"format"json")]
  679.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  680.     #[OA\Tag(name"ProfileListing")]
  681.     #[OA\Response(
  682.         response200,
  683.         description'',
  684.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  685.     )]
  686.     public function listWithVideo(Request $requestCity $city): Response
  687.     {
  688.         $specs $this->profileListSpecificationService->listWithVideo();
  689.         $response = new Response();
  690.         $result $this->paginatedListing($city'/city/{city}/with_video', ['city' => $city->getId()], $specs->spec(), nullnull$response);
  691.         if ($this->isApiRequest($request)) {
  692.             return $this->json($result);
  693.         }
  694.         return $this->render('ProfileList/list.html.twig', [
  695.             'profiles' => $result,
  696.             'source' => $this->source,
  697.             'source_default' => self::RESULT_SOURCE_WITH_VIDEO,
  698.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  699.                 'city' => $city->getUriIdentity(),
  700.                 'page' => $this->getCurrentPageNumber()
  701.             ]),
  702.             'recommendationSpec' => $specs->recommendationSpec(),
  703.         ], response$response);
  704.     }
  705.      /**
  706.      * @Feature("extra_category_round_the_clock")
  707.      */
  708.     #[ParamConverter("city"converter"city_converter")]
  709.     #[Route("/api/profiles/listing/city/{city}/category/round_the_clock"name"api.profile_listing.category.round_the_clock"methods"GET"format"json")]
  710.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  711.     #[OA\Tag(name"ProfileListing")]
  712.     #[OA\Response(
  713.         response200,
  714.         description'',
  715.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  716.     )]
  717.     public function listRoundTheClock(Request $requestCity $city): Response
  718.     {
  719.         $specs $this->profileListSpecificationService->listRoundTheClock();
  720.         $response = new Response();
  721.         $result $this->paginatedListing($city'/city/{city}/category/round_the_clock', ['city' => $city->getId()], $specs->spec(), nullnull$response);
  722.         if ($this->isApiRequest($request)) {
  723.             return $this->json($result);
  724.         }
  725.         return $this->render('ProfileList/list.html.twig', [
  726.             'profiles' => $result,
  727.             'source' => $this->source,
  728.             'source_default' => self::RESULT_SOURCE_ROUND_THE_CLOCK,
  729.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  730.                 'city' => $city->getUriIdentity(),
  731.                 'page' => $this->getCurrentPageNumber(),
  732.             ]),
  733.             'recommendationSpec' => $specs->recommendationSpec(),
  734.         ], response$response);
  735.     }
  736.     /**
  737.      * @Feature("extra_category_for_two_hours")
  738.      */
  739.     #[ParamConverter("city"converter"city_converter")]
  740.     #[Route("/api/profiles/listing/city/{city}/category/for_two_hours"name"api.profile_listing.category.for_two_hours"methods"GET"format"json")]
  741.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  742.     #[OA\Tag(name"ProfileListing")]
  743.     #[OA\Response(
  744.         response200,
  745.         description'',
  746.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  747.     )]
  748.     public function listForTwoHours(Request $requestCity $city): Response
  749.     {
  750.         $specs $this->profileListSpecificationService->listForTwoHours();
  751.         $response = new Response();
  752.         $result $this->paginatedListing($city'/city/{city}/category/for_two_hours', ['city' => $city->getId()], $specs->spec(), nullnull$response);
  753.         if ($this->isApiRequest($request)) {
  754.             return $this->json($result);
  755.         }
  756.         return $this->render('ProfileList/list.html.twig', [
  757.             'profiles' => $result,
  758.             'source' => $this->source,
  759.             'source_default' => self::RESULT_SOURCE_FOR_TWO_HOURS,
  760.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  761.                 'city' => $city->getUriIdentity(),
  762.                 'page' => $this->getCurrentPageNumber(),
  763.             ]),
  764.             'recommendationSpec' => $specs->recommendationSpec(),
  765.         ], response$response);
  766.     }
  767.     /**
  768.      * @Feature("extra_category_for_hour")
  769.      */
  770.     #[ParamConverter("city"converter"city_converter")]
  771.     #[Route("/api/profiles/listing/city/{city}/category/for_hour"name"api.profile_listing.category.for_hour"methods"GET"format"json")]
  772.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  773.     #[OA\Tag(name"ProfileListing")]
  774.     #[OA\Response(
  775.         response200,
  776.         description'',
  777.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  778.     )]
  779.     public function listForHour(Request $requestCity $city): Response
  780.     {
  781.         $specs $this->profileListSpecificationService->listForHour();
  782.         $response = new Response();
  783.         $result $this->paginatedListing($city'/city/{city}/category/for_hour', ['city' => $city->getId()], $specs->spec(), nullnull$response);
  784.         if ($this->isApiRequest($request)) {
  785.             return $this->json($result);
  786.         }
  787.         return $this->render('ProfileList/list.html.twig', [
  788.             'profiles' => $result,
  789.             'source' => $this->source,
  790.             'source_default' => self::RESULT_SOURCE_FOR_HOUR,
  791.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  792.                 'city' => $city->getUriIdentity(),
  793.                 'page' => $this->getCurrentPageNumber(),
  794.             ]),
  795.             'recommendationSpec' => $specs->recommendationSpec(),
  796.         ], response$response);
  797.     }
  798.     /**
  799.      * @Feature("extra_category_express_program")
  800.      */
  801.     #[ParamConverter("city"converter"city_converter")]
  802.     #[Route("/api/profiles/listing/city/{city}/category/express"name"api.profile_listing.category.express"methods"GET"format"json")]
  803.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  804.     #[OA\Tag(name"ProfileListing")]
  805.     #[OA\Response(
  806.         response200,
  807.         description'',
  808.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  809.     )]
  810.     public function listExpress(Request $requestCity $city): Response
  811.     {
  812.         $specs $this->profileListSpecificationService->listExpress();
  813.         $response = new Response();
  814.         $result $this->paginatedListing($city'/city/{city}/category/express', ['city' => $city->getId()], $specs->spec(), nullnull$response);
  815.         if ($this->isApiRequest($request)) {
  816.             return $this->json($result);
  817.         }
  818.         return $this->render('ProfileList/list.html.twig', [
  819.             'profiles' => $result,
  820.             'source' => $this->source,
  821.             'source_default' => self::RESULT_SOURCE_EXPRESS_PROGRAM,
  822.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  823.                 'city' => $city->getUriIdentity(),
  824.                 'page' => $this->getCurrentPageNumber(),
  825.             ]),
  826.             'recommendationSpec' => $specs->recommendationSpec(),
  827.         ], response$response);
  828.     }
  829.     /**
  830.      * @Feature("extra_category_grandmothers")
  831.      */
  832.     #[ParamConverter("city"converter"city_converter")]
  833.     #[Route("/api/profiles/listing/city/{city}/category/grandmothers"name"api.profile_listing.category.grandmothers"methods"GET"format"json")]
  834.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  835.     #[OA\Tag(name"ProfileListing")]
  836.     #[OA\Response(
  837.         response200,
  838.         description'',
  839.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  840.     )]
  841.     public function listGrandmothers(Request $requestCity $city): Response
  842.     {
  843.         $specs $this->profileListSpecificationService->listGrandmothers();
  844.         $response = new Response();
  845.         $result $this->paginatedListing($city'/city/{city}/category/grandmothers', ['city' => $city->getId()], $specs->spec(), nullnull$response);
  846.         if ($this->isApiRequest($request)) {
  847.             return $this->json($result);
  848.         }
  849.         return $this->render('ProfileList/list.html.twig', [
  850.             'profiles' => $result,
  851.             'source' => $this->source,
  852.             'source_default' => 'grandmothers',
  853.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  854.                 'city' => $city->getUriIdentity(),
  855.                 'page' => $this->getCurrentPageNumber(),
  856.             ]),
  857.             'recommendationSpec' => $specs->recommendationSpec(),
  858.         ], response$response);
  859.     }
  860.         /**
  861.      * @Feature("extra_category_big_breast")
  862.      */
  863.     #[ParamConverter("city"converter"city_converter")]
  864.     #[Route("/api/profiles/listing/city/{city}/category/big_breast"name"api.profile_listing.category.big_breast"methods"GET"format"json")]
  865.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  866.     #[OA\Tag(name"ProfileListing")]
  867.     #[OA\Response(
  868.         response200,
  869.         description'',
  870.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  871.     )]
  872.     public function listBigBreast(Request $requestCity $city): Response
  873.     {
  874.         $specs $this->profileListSpecificationService->listBigBreast();
  875.         $response = new Response();
  876.         $result $this->paginatedListing($city'/city/{city}/category/big_breast', ['city' => $city->getId()], $specs->spec(), nullnull$response);
  877.         if ($this->isApiRequest($request)) {
  878.             return $this->json($result);
  879.         }
  880.         return $this->render('ProfileList/list.html.twig', [
  881.             'profiles' => $result,
  882.             'source' => $this->source,
  883.             'source_default' => 'big_breast',
  884.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  885.                 'city' => $city->getUriIdentity(),
  886.                 'page' => $this->getCurrentPageNumber(),
  887.             ]),
  888.             'recommendationSpec' => $specs->recommendationSpec(),
  889.         ], response$response);
  890.     }
  891.     /**
  892.      * @Feature("extra_category_very_skinny")
  893.      */
  894.     #[ParamConverter("city"converter"city_converter")]
  895.     #[Route("/api/profiles/listing/city/{city}/category/very_skinny"name"api.profile_listing.category.very_skinny"methods"GET"format"json")]
  896.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  897.     #[OA\Tag(name"ProfileListing")]
  898.     #[OA\Response(
  899.         response200,
  900.         description'',
  901.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  902.     )]
  903.     public function listVerySkinny(Request $requestCity $city): Response
  904.     {
  905.         $specs $this->profileListSpecificationService->listVerySkinny();
  906.         $response = new Response();
  907.         $result $this->paginatedListing($city'/city/{city}/category/very_skinny', ['city' => $city->getId()], $specs->spec(), nullnull$response);
  908.         if ($this->isApiRequest($request)) {
  909.             return $this->json($result);
  910.         }
  911.         return $this->render('ProfileList/list.html.twig', [
  912.             'profiles' => $result,
  913.             'source' => $this->source,
  914.             'source_default' => 'very_skinny',
  915.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  916.                 'city' => $city->getUriIdentity(),
  917.                 'page' => $this->getCurrentPageNumber(),
  918.             ]),
  919.             'recommendationSpec' => $specs->recommendationSpec(),
  920.         ], response$response);
  921.     }
  922.     /**
  923.      * @Feature("extra_category_small_ass")
  924.      */
  925.     #[ParamConverter("city"converter"city_converter")]
  926.     #[Route("/api/profiles/listing/city/{city}/category/small_ass"name"api.profile_listing.category.small_ass"methods"GET"format"json")]
  927.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  928.     #[OA\Tag(name"ProfileListing")]
  929.     #[OA\Response(
  930.         response200,
  931.         description'',
  932.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  933.     )]
  934.     public function listSmallAss(Request $requestCity $city): Response
  935.     {
  936.         $specs $this->profileListSpecificationService->listSmallAss();
  937.         $response = new Response();
  938.         $result $this->paginatedListing($city'/city/{city}/category/small_ass', ['city' => $city->getId()], $specs->spec(), nullnull$response);
  939.         if ($this->isApiRequest($request)) {
  940.             return $this->json($result);
  941.         }
  942.         return $this->render('ProfileList/list.html.twig', [
  943.             'profiles' => $result,
  944.             'source' => $this->source,
  945.             'source_default' => 'small_ass',
  946.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  947.                 'city' => $city->getUriIdentity(),
  948.                 'page' => $this->getCurrentPageNumber(),
  949.             ]),
  950.             'recommendationSpec' => $specs->recommendationSpec(),
  951.         ], response$response);
  952.     }
  953.     /**
  954.      * @Feature("extra_category_beautiful_prostitutes")
  955.      */
  956.     #[ParamConverter("city"converter"city_converter")]
  957.     #[Route("/api/profiles/listing/city/{city}/category/beautiful_prostitutes"name"api.profile_listing.category.beautiful_prostitutes"methods"GET"format"json")]
  958.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  959.     #[OA\Tag(name"ProfileListing")]
  960.     #[OA\Response(
  961.         response200,
  962.         description'',
  963.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  964.     )]
  965.     public function listBeautifulProstitutes(Request $requestCity $city): Response
  966.     {
  967.         $specs $this->profileListSpecificationService->listBeautifulProstitutes();
  968.         $response = new Response();
  969.         $result $this->paginatedListing($city'/city/{city}/category/beautiful_prostitutes', ['city' => $city->getId()], $specs->spec(), nullnull$response);
  970.         if ($this->isApiRequest($request)) {
  971.             return $this->json($result);
  972.         }
  973.         return $this->render('ProfileList/list.html.twig', [
  974.             'profiles' => $result,
  975.             'source' => $this->source,
  976.             'source_default' => 'beautiful_prostitutes',
  977.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  978.                 'city' => $city->getUriIdentity(),
  979.                 'page' => $this->getCurrentPageNumber(),
  980.             ]),
  981.             'recommendationSpec' => $specs->recommendationSpec(),
  982.         ], response$response);
  983.     }
  984.     /**
  985.      * @Feature("extra_category_without_intermediaries")
  986.      */
  987.     #[ParamConverter("city"converter"city_converter")]
  988.     #[Route("/api/profiles/listing/city/{city}/category/without_intermediaries"name"api.profile_listing.category.without_intermediaries"methods"GET"format"json")]
  989.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  990.     #[OA\Tag(name"ProfileListing")]
  991.     #[OA\Response(
  992.         response200,
  993.         description'',
  994.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  995.     )]
  996.     public function listWithoutIntermediaries(Request $requestCity $city): Response
  997.     {
  998.         $specs $this->profileListSpecificationService->listWithoutIntermediaries();
  999.         $response = new Response();
  1000.         $result $this->paginatedListing($city'/city/{city}/category/without_intermediaries', ['city' => $city->getId()], $specs->spec(), nullnull$response);
  1001.         if ($this->isApiRequest($request)) {
  1002.             return $this->json($result);
  1003.         }
  1004.         return $this->render('ProfileList/list.html.twig', [
  1005.             'profiles' => $result,
  1006.             'source' => $this->source,
  1007.             'source_default' => 'without_intermediaries',
  1008.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  1009.                 'city' => $city->getUriIdentity(),
  1010.                 'page' => $this->getCurrentPageNumber(),
  1011.             ]),
  1012.             'recommendationSpec' => $specs->recommendationSpec(),
  1013.         ], response$response);
  1014.     }
  1015.     /**
  1016.      * @Feature("extra_category_intim_services")
  1017.      */
  1018.     #[ParamConverter("city"converter"city_converter")]
  1019.     public function intimServices(Request $requestCity $city): Response
  1020.     {
  1021.         $servicesByGroup $this->serviceRepository->allIndexedByGroup();
  1022.         return $this->render('ProfileList/intim_services.html.twig', [
  1023.             'city' => $city,
  1024.             'servicesByGroup' => $servicesByGroup,
  1025.             'skipSetCurrentListingPage' => true,
  1026.         ]);
  1027.     }
  1028.     /**
  1029.      * @Feature("extra_category_outcall")
  1030.      */
  1031.     #[ParamConverter("city"converter"city_converter")]
  1032.     #[Route("/api/profiles/listing/city/{city}/category/outcall"name"api.profile_listing.category.outcall"methods"GET"format"json")]
  1033.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  1034.     #[OA\Tag(name"ProfileListing")]
  1035.     #[OA\Response(
  1036.         response200,
  1037.         description'',
  1038.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  1039.     )]
  1040.     public function listOutcall(Request $requestCity $city): Response
  1041.     {
  1042.         $specs $this->profileListSpecificationService->listByOutcall();
  1043.         $response = new Response();
  1044.         $result $this->paginatedListing($city'/city/{city}/category/outcall', ['city' => $city->getId()], $specs->spec(), nullnull$response);
  1045.         if ($this->isApiRequest($request)) {
  1046.             return $this->json($result);
  1047.         }
  1048.         return $this->render('ProfileList/list.html.twig', [
  1049.             'profiles' => $result,
  1050.             'source' => $this->source,
  1051.             'source_default' => 'outcall',
  1052.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  1053.                 'city' => $city->getUriIdentity(),
  1054.                 'page' => $this->getCurrentPageNumber(),
  1055.             ]),
  1056.             'recommendationSpec' => $specs->recommendationSpec(),
  1057.         ], response$response);
  1058.     }
  1059.     /**
  1060.      * @Feature("extra_category_dwarfs")
  1061.      */
  1062.     #[ParamConverter("city"converter"city_converter")]
  1063.     #[Route("/api/profiles/listing/city/{city}/category/dwarfs"name"api.profile_listing.category.dwarfs"methods"GET"format"json")]
  1064.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  1065.     #[OA\Tag(name"ProfileListing")]
  1066.     #[OA\Response(
  1067.         response200,
  1068.         description'',
  1069.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  1070.     )]
  1071.     public function listDwarfs(Request $requestCity $city): Response
  1072.     {
  1073.         $specs $this->profileListSpecificationService->listDwarfs();
  1074.         $response = new Response();
  1075.         $result $this->paginatedListing($city'/city/{city}/category/dwarfs', ['city' => $city->getId()], $specs->spec(), nullnull$response);
  1076.         if ($this->isApiRequest($request)) {
  1077.             return $this->json($result);
  1078.         }
  1079.         return $this->render('ProfileList/list.html.twig', [
  1080.             'profiles' => $result,
  1081.             'source' => $this->source,
  1082.             'source_default' => 'dwarfs',
  1083.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  1084.                 'city' => $city->getUriIdentity(),
  1085.                 'page' => $this->getCurrentPageNumber(),
  1086.             ]),
  1087.             'recommendationSpec' => $specs->recommendationSpec(),
  1088.         ], response$response);
  1089.     }
  1090.     #[ParamConverter("city"converter"city_converter")]
  1091.     #[Route("/api/profiles/listing/city/{city}/with_selfie"name"api.profile_listing.with_selfie"methods"GET"format"json")]
  1092.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  1093.     #[OA\Tag(name"ProfileListing")]
  1094.     #[OA\Response(
  1095.         response200,
  1096.         description'',
  1097.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  1098.     )]
  1099.     public function listWithSelfie(Request $requestCity $city): Response
  1100.     {
  1101.         $specs $this->profileListSpecificationService->listWithSelfie();
  1102.         $response = new Response();
  1103.         $result $this->paginatedListing($city'/city/{city}/with_selfie', ['city' => $city->getId()], $specs->spec(), nullnull$response);
  1104.         if ($this->isApiRequest($request)) {
  1105.             return $this->json($result);
  1106.         }
  1107.         return $this->render('ProfileList/list.html.twig', [
  1108.             'profiles' => $result,
  1109.             'source' => $this->source,
  1110.             'source_default' => self::RESULT_SOURCE_WITH_SELFIE,
  1111.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  1112.                 'city' => $city->getUriIdentity(),
  1113.                 'page' => $this->getCurrentPageNumber()
  1114.             ]),
  1115.             'recommendationSpec' => $specs->recommendationSpec(),
  1116.         ], response$response);
  1117.     }
  1118.     /**
  1119.      * @Feature("extra_category_top_100")
  1120.      */
  1121.     #[ParamConverter("city"converter"city_converter")]
  1122.     #[Route("/api/profiles/listing/city/{city}/category/top_100"name"api.profile_listing.category.top_100"methods"GET"format"json")]
  1123.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  1124.     #[OA\Tag(name"ProfileListing")]
  1125.     #[OA\Response(
  1126.         response200,
  1127.         description'',
  1128.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  1129.     )]
  1130.     public function listTop100(Request $requestCity $city): Response
  1131.     {
  1132.         $specs $this->profileListSpecificationService->listApproved();
  1133.         $result $this->top100ProfilesService->getSortedProfilesByVisits($city);
  1134.         if ($this->isApiRequest($request)) {
  1135.             return $this->json($result);
  1136.         }
  1137.         return $this->render('ProfileList/list.html.twig', [
  1138.             'profiles' => $result,
  1139.             'source' => self::RESULT_SOURCE_TOP_100,
  1140.             'source_default' => self::RESULT_SOURCE_TOP_100,
  1141.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  1142.                 'city' => $city->getUriIdentity(),
  1143.                 'page' => $this->getCurrentPageNumber(),
  1144.             ]),
  1145.             'recommendationSpec' => $specs->recommendationSpec(),
  1146.         ]);
  1147.     }
  1148.     /**
  1149.      * @Feature("extra_category_eromassage")
  1150.      */
  1151.     #[ParamConverter("city"converter"city_converter")]
  1152.     #[Entity("county"expr"repository.ofUriIdentityWithinCity(county, city)")]
  1153.     public function listByCountyEromassage(Request $requestCity $cityCounty $county): Response
  1154.     {
  1155.         if (!$city->hasCounty($county)) {
  1156.             throw $this->createNotFoundException();
  1157.         }
  1158.         $specs $this->profileListSpecificationService->listByCountyEromassage($county);
  1159.         $response = new Response();
  1160.         $result $this->paginatedListing(
  1161.             $city,
  1162.             '/city/{city}/county/{county}/eromassage',
  1163.             ['city' => $city->getId(), 'county' => $county->getId()],
  1164.             $specs->spec(),
  1165.             null,
  1166.             null,
  1167.             $response
  1168.         );
  1169.         $request->attributes->set('profiles_count'$result->totalCount());
  1170.         return $this->render('ProfileList/list.html.twig', [
  1171.             'profiles' => $result,
  1172.             'source' => $this->source,
  1173.             'source_default' => self::RESULT_SOURCE_EROMASSAGE,
  1174.             'county' => $county,
  1175.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  1176.                 'city' => $city->getUriIdentity(),
  1177.                 'county' => $county->getUriIdentity(),
  1178.                 'page' => $this->getCurrentPageNumber(),
  1179.             ]),
  1180.             'recommendationSpec' => $specs->recommendationSpec(),
  1181.         ], response$response);
  1182.     }
  1183.     /**
  1184.      * @Feature("extra_category_eromassage")
  1185.      */
  1186.     #[ParamConverter("city"converter"city_converter")]
  1187.     #[Entity("district"expr"repository.ofUriIdentityWithinCity(district, city)")]
  1188.     public function listByDistrictEromassage(Request $requestCity $cityDistrict $district): Response
  1189.     {
  1190.         if (!$city->hasDistrict($district)) {
  1191.             throw $this->createNotFoundException();
  1192.         }
  1193.         $specs $this->profileListSpecificationService->listByDistrictEromassage($district);
  1194.         $response = new Response();
  1195.         $result $this->paginatedListing(
  1196.             $city,
  1197.             '/city/{city}/district/{district}/eromassage',
  1198.             ['city' => $city->getId(), 'district' => $district->getId()],
  1199.             $specs->spec(),
  1200.             null,
  1201.             null,
  1202.             $response
  1203.         );
  1204.         $request->attributes->set('profiles_count'$result->totalCount());
  1205.         return $this->render('ProfileList/list.html.twig', [
  1206.             'profiles' => $result,
  1207.             'source' => $this->source,
  1208.             'source_default' => self::RESULT_SOURCE_EROMASSAGE,
  1209.             'district' => $district,
  1210.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  1211.                 'city' => $city->getUriIdentity(),
  1212.                 'district' => $district->getUriIdentity(),
  1213.                 'page' => $this->getCurrentPageNumber(),
  1214.             ]),
  1215.             'recommendationSpec' => $specs->recommendationSpec(),
  1216.         ], response$response);
  1217.     }
  1218.     /**
  1219.      * @Feature("extra_category_eromassage")
  1220.      */
  1221.     #[ParamConverter("city"converter"city_converter")]
  1222.     #[Entity("station"expr"repository.ofUriIdentityWithinCity(station, city)")]
  1223.     public function listByStationEromassage(Request $requestCity $cityStation $station): Response
  1224.     {
  1225.         if (!$city->hasStation($station)) {
  1226.             throw $this->createNotFoundException();
  1227.         }
  1228.         $specs $this->profileListSpecificationService->listByStationEromassage($station);
  1229.         $response = new Response();
  1230.         $result $this->paginatedListing(
  1231.             $city,
  1232.             '/city/{city}/station/{station}/eromassage',
  1233.             ['city' => $city->getId(), 'station' => $station->getId()],
  1234.             $specs->spec(),
  1235.             null,
  1236.             null,
  1237.             $response
  1238.         );
  1239.         $request->attributes->set('profiles_count'$result->totalCount());
  1240.         return $this->render('ProfileList/list.html.twig', [
  1241.             'profiles' => $result,
  1242.             'source' => $this->source,
  1243.             'source_default' => self::RESULT_SOURCE_EROMASSAGE,
  1244.             'station' => $station,
  1245.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  1246.                 'city' => $city->getUriIdentity(),
  1247.                 'station' => $station->getUriIdentity(),
  1248.                 'page' => $this->getCurrentPageNumber(),
  1249.             ]),
  1250.             'recommendationSpec' => $specs->recommendationSpec(),
  1251.         ], response$response);
  1252.     }
  1253.     /**
  1254.      * @Feature("extra_category_verified")
  1255.      */
  1256.     #[ParamConverter("city"converter"city_converter")]
  1257.     #[Entity("county"expr"repository.ofUriIdentityWithinCity(county, city)")]
  1258.     public function listByCountyVerified(Request $requestCity $cityCounty $county): Response
  1259.     {
  1260.         if (!$city->hasCounty($county)) {
  1261.             throw $this->createNotFoundException();
  1262.         }
  1263.         $specs $this->profileListSpecificationService->listByCountyVerified($county);
  1264.         $response = new Response();
  1265.         $result $this->paginatedListing(
  1266.             $city,
  1267.             '/city/{city}/county/{county}/proverennye',
  1268.             ['city' => $city->getId(), 'county' => $county->getId()],
  1269.             $specs->spec(),
  1270.             null,
  1271.             null,
  1272.             $response
  1273.         );
  1274.         $request->attributes->set('profiles_count'$result->totalCount());
  1275.         return $this->render('ProfileList/list.html.twig', [
  1276.             'profiles' => $result,
  1277.             'source' => $this->source,
  1278.             'source_default' => self::RESULT_SOURCE_VERIFIED,
  1279.             'county' => $county,
  1280.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  1281.                 'city' => $city->getUriIdentity(),
  1282.                 'county' => $county->getUriIdentity(),
  1283.                 'page' => $this->getCurrentPageNumber(),
  1284.             ]),
  1285.             'recommendationSpec' => $specs->recommendationSpec(),
  1286.         ], response$response);
  1287.     }
  1288.     /**
  1289.      * @Feature("extra_category_verified")
  1290.      */
  1291.     #[ParamConverter("city"converter"city_converter")]
  1292.     #[Entity("district"expr"repository.ofUriIdentityWithinCity(district, city)")]
  1293.     public function listByDistrictVerified(Request $requestCity $cityDistrict $district): Response
  1294.     {
  1295.         if (!$city->hasDistrict($district)) {
  1296.             throw $this->createNotFoundException();
  1297.         }
  1298.         $specs $this->profileListSpecificationService->listByDistrictVerified($district);
  1299.         $response = new Response();
  1300.         $result $this->paginatedListing(
  1301.             $city,
  1302.             '/city/{city}/district/{district}/proverennye',
  1303.             ['city' => $city->getId(), 'district' => $district->getId()],
  1304.             $specs->spec(),
  1305.             null,
  1306.             null,
  1307.             $response
  1308.         );
  1309.         $request->attributes->set('profiles_count'$result->totalCount());
  1310.         return $this->render('ProfileList/list.html.twig', [
  1311.             'profiles' => $result,
  1312.             'source' => $this->source,
  1313.             'source_default' => self::RESULT_SOURCE_VERIFIED,
  1314.             'district' => $district,
  1315.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  1316.                 'city' => $city->getUriIdentity(),
  1317.                 'district' => $district->getUriIdentity(),
  1318.                 'page' => $this->getCurrentPageNumber(),
  1319.             ]),
  1320.             'recommendationSpec' => $specs->recommendationSpec(),
  1321.         ], response$response);
  1322.     }
  1323.     /**
  1324.      * @Feature("extra_category_verified")
  1325.      */
  1326.     #[ParamConverter("city"converter"city_converter")]
  1327.     #[Entity("station"expr"repository.ofUriIdentityWithinCity(station, city)")]
  1328.     public function listByStationVerified(Request $requestCity $cityStation $station): Response
  1329.     {
  1330.         if (!$city->hasStation($station)) {
  1331.             throw $this->createNotFoundException();
  1332.         }
  1333.         $specs $this->profileListSpecificationService->listByStationVerified($station);
  1334.         $response = new Response();
  1335.         $result $this->paginatedListing(
  1336.             $city,
  1337.             '/city/{city}/station/{station}/proverennye',
  1338.             ['city' => $city->getId(), 'station' => $station->getId()],
  1339.             $specs->spec(),
  1340.             null,
  1341.             null,
  1342.             $response
  1343.         );
  1344.         $request->attributes->set('profiles_count'$result->totalCount());
  1345.         return $this->render('ProfileList/list.html.twig', [
  1346.             'profiles' => $result,
  1347.             'source' => $this->source,
  1348.             'source_default' => self::RESULT_SOURCE_VERIFIED,
  1349.             'station' => $station,
  1350.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  1351.                 'city' => $city->getUriIdentity(),
  1352.                 'station' => $station->getUriIdentity(),
  1353.                 'page' => $this->getCurrentPageNumber(),
  1354.             ]),
  1355.             'recommendationSpec' => $specs->recommendationSpec(),
  1356.         ], response$response);
  1357.     }
  1358.     /**
  1359.      * @Feature("extra_category_cheap")
  1360.      */
  1361.     #[ParamConverter("city"converter"city_converter")]
  1362.     #[Entity("county"expr"repository.ofUriIdentityWithinCity(county, city)")]
  1363.     public function listByCountyCheap(Request $requestCity $cityCounty $county): Response
  1364.     {
  1365.         if (!$city->hasCounty($county)) {
  1366.             throw $this->createNotFoundException();
  1367.         }
  1368.         $specs $this->profileListSpecificationService->listByCountyCheap($county);
  1369.         $response = new Response();
  1370.         $result $this->paginatedListing(
  1371.             $city,
  1372.             null,
  1373.             [],
  1374.             $specs->spec(),
  1375.             null,
  1376.             null,
  1377.             $response
  1378.         );
  1379.         $request->attributes->set('profiles_count'$result->totalCount());
  1380.         return $this->render('ProfileList/list.html.twig', [
  1381.             'profiles' => $result,
  1382.             'source' => $this->source,
  1383.             'source_default' => self::RESULT_SOURCE_CHEAP,
  1384.             'county' => $county,
  1385.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  1386.                 'city' => $city->getUriIdentity(),
  1387.                 'county' => $county->getUriIdentity(),
  1388.                 'page' => $this->getCurrentPageNumber(),
  1389.             ]),
  1390.             'recommendationSpec' => $specs->recommendationSpec(),
  1391.         ], response$response);
  1392.     }
  1393.     /**
  1394.      * @Feature("extra_category_cheap")
  1395.      */
  1396.     #[ParamConverter("city"converter"city_converter")]
  1397.     #[Entity("district"expr"repository.ofUriIdentityWithinCity(district, city)")]
  1398.     public function listByDistrictCheap(Request $requestCity $cityDistrict $district): Response
  1399.     {
  1400.         if (!$city->hasDistrict($district)) {
  1401.             throw $this->createNotFoundException();
  1402.         }
  1403.         $specs $this->profileListSpecificationService->listByDistrictCheap($district);
  1404.         $response = new Response();
  1405.         $result $this->paginatedListing(
  1406.             $city,
  1407.             null,
  1408.             [],
  1409.             $specs->spec(),
  1410.             null,
  1411.             null,
  1412.             $response
  1413.         );
  1414.         $request->attributes->set('profiles_count'$result->totalCount());
  1415.         return $this->render('ProfileList/list.html.twig', [
  1416.             'profiles' => $result,
  1417.             'source' => $this->source,
  1418.             'source_default' => self::RESULT_SOURCE_CHEAP,
  1419.             'district' => $district,
  1420.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  1421.                 'city' => $city->getUriIdentity(),
  1422.                 'district' => $district->getUriIdentity(),
  1423.                 'page' => $this->getCurrentPageNumber(),
  1424.             ]),
  1425.             'recommendationSpec' => $specs->recommendationSpec(),
  1426.         ], response$response);
  1427.     }
  1428.     /**
  1429.      * @Feature("extra_category_cheap")
  1430.      */
  1431.     #[ParamConverter("city"converter"city_converter")]
  1432.     #[Entity("station"expr"repository.ofUriIdentityWithinCity(station, city)")]
  1433.     public function listByStationCheap(Request $requestCity $cityStation $station): Response
  1434.     {
  1435.         if (!$city->hasStation($station)) {
  1436.             throw $this->createNotFoundException();
  1437.         }
  1438.         $specs $this->profileListSpecificationService->listByStationCheap($station);
  1439.         $response = new Response();
  1440.         $result $this->paginatedListing(
  1441.             $city,
  1442.             null,
  1443.             [],
  1444.             $specs->spec(),
  1445.             null,
  1446.             null,
  1447.             $response
  1448.         );
  1449.         $request->attributes->set('profiles_count'$result->totalCount());
  1450.         return $this->render('ProfileList/list.html.twig', [
  1451.             'profiles' => $result,
  1452.             'source' => $this->source,
  1453.             'source_default' => self::RESULT_SOURCE_CHEAP,
  1454.             'station' => $station,
  1455.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  1456.                 'city' => $city->getUriIdentity(),
  1457.                 'station' => $station->getUriIdentity(),
  1458.                 'page' => $this->getCurrentPageNumber(),
  1459.             ]),
  1460.             'recommendationSpec' => $specs->recommendationSpec(),
  1461.         ], response$response);
  1462.     }
  1463.     /**
  1464.      * @Feature("extra_category_mature")
  1465.      */
  1466.     #[ParamConverter("city"converter"city_converter")]
  1467.     #[Entity("county"expr"repository.ofUriIdentityWithinCity(county, city)")]
  1468.     public function listByCountyMature(Request $requestCity $cityCounty $county): Response
  1469.     {
  1470.         if (!$city->hasCounty($county)) {
  1471.             throw $this->createNotFoundException();
  1472.         }
  1473.         $specs $this->profileListSpecificationService->listByCountyMature($county);
  1474.         $response = new Response();
  1475.         $result $this->paginatedListing(
  1476.             $city,
  1477.             null,
  1478.             [],
  1479.             $specs->spec(),
  1480.             null,
  1481.             null,
  1482.             $response
  1483.         );
  1484.         $request->attributes->set('profiles_count'$result->totalCount());
  1485.         return $this->render('ProfileList/list.html.twig', [
  1486.             'profiles' => $result,
  1487.             'source' => $this->source,
  1488.             'source_default' => self::RESULT_SOURCE_MATURE,
  1489.             'county' => $county,
  1490.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  1491.                 'city' => $city->getUriIdentity(),
  1492.                 'county' => $county->getUriIdentity(),
  1493.                 'page' => $this->getCurrentPageNumber(),
  1494.             ]),
  1495.             'recommendationSpec' => $specs->recommendationSpec(),
  1496.         ], response$response);
  1497.     }
  1498.     /**
  1499.      * @Feature("extra_category_mature")
  1500.      */
  1501.     #[ParamConverter("city"converter"city_converter")]
  1502.     #[Entity("district"expr"repository.ofUriIdentityWithinCity(district, city)")]
  1503.     public function listByDistrictMature(Request $requestCity $cityDistrict $district): Response
  1504.     {
  1505.         if (!$city->hasDistrict($district)) {
  1506.             throw $this->createNotFoundException();
  1507.         }
  1508.         $specs $this->profileListSpecificationService->listByDistrictMature($district);
  1509.         $response = new Response();
  1510.         $result $this->paginatedListing(
  1511.             $city,
  1512.             null,
  1513.             [],
  1514.             $specs->spec(),
  1515.             null,
  1516.             null,
  1517.             $response
  1518.         );
  1519.         $request->attributes->set('profiles_count'$result->totalCount());
  1520.         return $this->render('ProfileList/list.html.twig', [
  1521.             'profiles' => $result,
  1522.             'source' => $this->source,
  1523.             'source_default' => self::RESULT_SOURCE_MATURE,
  1524.             'district' => $district,
  1525.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  1526.                 'city' => $city->getUriIdentity(),
  1527.                 'district' => $district->getUriIdentity(),
  1528.                 'page' => $this->getCurrentPageNumber(),
  1529.             ]),
  1530.             'recommendationSpec' => $specs->recommendationSpec(),
  1531.         ], response$response);
  1532.     }
  1533.     /**
  1534.      * @Feature("extra_category_mature")
  1535.      */
  1536.     #[ParamConverter("city"converter"city_converter")]
  1537.     #[Entity("station"expr"repository.ofUriIdentityWithinCity(station, city)")]
  1538.     public function listByStationMature(Request $requestCity $cityStation $station): Response
  1539.     {
  1540.         if (!$city->hasStation($station)) {
  1541.             throw $this->createNotFoundException();
  1542.         }
  1543.         $specs $this->profileListSpecificationService->listByStationMature($station);
  1544.         $response = new Response();
  1545.         $result $this->paginatedListing(
  1546.             $city,
  1547.             null,
  1548.             [],
  1549.             $specs->spec(),
  1550.             null,
  1551.             null,
  1552.             $response
  1553.         );
  1554.         $request->attributes->set('profiles_count'$result->totalCount());
  1555.         return $this->render('ProfileList/list.html.twig', [
  1556.             'profiles' => $result,
  1557.             'source' => $this->source,
  1558.             'source_default' => self::RESULT_SOURCE_MATURE,
  1559.             'station' => $station,
  1560.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  1561.                 'city' => $city->getUriIdentity(),
  1562.                 'station' => $station->getUriIdentity(),
  1563.                 'page' => $this->getCurrentPageNumber(),
  1564.             ]),
  1565.             'recommendationSpec' => $specs->recommendationSpec(),
  1566.         ], response$response);
  1567.     }
  1568.     /**
  1569.      * @Feature("extra_category_uzbek")
  1570.      */
  1571.     #[ParamConverter("city"converter"city_converter")]
  1572.     #[Entity("county"expr"repository.ofUriIdentityWithinCity(county, city)")]
  1573.     public function listByCountyUzbek(Request $requestCity $cityCounty $county): Response
  1574.     {
  1575.         if (!$city->hasCounty($county)) {
  1576.             throw $this->createNotFoundException();
  1577.         }
  1578.         $specs $this->profileListSpecificationService->listByCountyUzbek($county);
  1579.         $response = new Response();
  1580.         $result $this->paginatedListing(
  1581.             $city,
  1582.             '/city/{city}/county/{county}/uzbechki',
  1583.             ['city' => $city->getId(), 'county' => $county->getId()],
  1584.             $specs->spec(),
  1585.             null,
  1586.             null,
  1587.             $response
  1588.         );
  1589.         $request->attributes->set('profiles_count'$result->totalCount());
  1590.         return $this->render('ProfileList/list.html.twig', [
  1591.             'profiles' => $result,
  1592.             'source' => $this->source,
  1593.             'source_default' => self::RESULT_SOURCE_UZBEK,
  1594.             'county' => $county,
  1595.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  1596.                 'city' => $city->getUriIdentity(),
  1597.                 'county' => $county->getUriIdentity(),
  1598.                 'page' => $this->getCurrentPageNumber(),
  1599.             ]),
  1600.             'recommendationSpec' => $specs->recommendationSpec(),
  1601.         ], response$response);
  1602.     }
  1603.     /**
  1604.      * @Feature("extra_category_uzbek")
  1605.      */
  1606.     #[ParamConverter("city"converter"city_converter")]
  1607.     #[Entity("district"expr"repository.ofUriIdentityWithinCity(district, city)")]
  1608.     public function listByDistrictUzbek(Request $requestCity $cityDistrict $district): Response
  1609.     {
  1610.         if (!$city->hasDistrict($district)) {
  1611.             throw $this->createNotFoundException();
  1612.         }
  1613.         $specs $this->profileListSpecificationService->listByDistrictUzbek($district);
  1614.         $response = new Response();
  1615.         $result $this->paginatedListing(
  1616.             $city,
  1617.             '/city/{city}/district/{district}/uzbechki',
  1618.             ['city' => $city->getId(), 'district' => $district->getId()],
  1619.             $specs->spec(),
  1620.             null,
  1621.             null,
  1622.             $response
  1623.         );
  1624.         $request->attributes->set('profiles_count'$result->totalCount());
  1625.         return $this->render('ProfileList/list.html.twig', [
  1626.             'profiles' => $result,
  1627.             'source' => $this->source,
  1628.             'source_default' => self::RESULT_SOURCE_UZBEK,
  1629.             'district' => $district,
  1630.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  1631.                 'city' => $city->getUriIdentity(),
  1632.                 'district' => $district->getUriIdentity(),
  1633.                 'page' => $this->getCurrentPageNumber(),
  1634.             ]),
  1635.             'recommendationSpec' => $specs->recommendationSpec(),
  1636.         ], response$response);
  1637.     }
  1638.     /**
  1639.      * @Feature("extra_category_uzbek")
  1640.      */
  1641.     #[ParamConverter("city"converter"city_converter")]
  1642.     #[Entity("station"expr"repository.ofUriIdentityWithinCity(station, city)")]
  1643.     public function listByStationUzbek(Request $requestCity $cityStation $station): Response
  1644.     {
  1645.         if (!$city->hasStation($station)) {
  1646.             throw $this->createNotFoundException();
  1647.         }
  1648.         $specs $this->profileListSpecificationService->listByStationUzbek($station);
  1649.         $response = new Response();
  1650.         $result $this->paginatedListing(
  1651.             $city,
  1652.             '/city/{city}/station/{station}/uzbechki',
  1653.             ['city' => $city->getId(), 'station' => $station->getId()],
  1654.             $specs->spec(),
  1655.             null,
  1656.             null,
  1657.             $response
  1658.         );
  1659.         $request->attributes->set('profiles_count'$result->totalCount());
  1660.         return $this->render('ProfileList/list.html.twig', [
  1661.             'profiles' => $result,
  1662.             'source' => $this->source,
  1663.             'source_default' => self::RESULT_SOURCE_UZBEK,
  1664.             'station' => $station,
  1665.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  1666.                 'city' => $city->getUriIdentity(),
  1667.                 'station' => $station->getUriIdentity(),
  1668.                 'page' => $this->getCurrentPageNumber(),
  1669.             ]),
  1670.             'recommendationSpec' => $specs->recommendationSpec(),
  1671.         ], response$response);
  1672.     }
  1673.     #[ParamConverter("city"converter"city_converter")]
  1674.     #[Route("/api/profiles/listing/city/{city}/price/{priceType}"name"api.profile_listing.by_price"methods"GET"format"json")]
  1675.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  1676.     #[OA\Tag(name"ProfileListing")]
  1677.     #[OA\Response(
  1678.         response200,
  1679.         description'',
  1680.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  1681.     )]
  1682.     public function listByPrice(Request $requestCountryCurrencyResolver $countryCurrencyResolverCity $citystring $priceTypeint $minPrice nullint $maxPrice null): Response
  1683.     {
  1684.         $specs $this->profileListSpecificationService->listByPrice($city$priceType$minPrice$maxPrice);
  1685.         $response = new Response();
  1686.         $apiEndpoint in_array($priceType, ['low''high''elite']) ? '/city/{city}/price/'.$priceType null;
  1687.         $result $this->paginatedListing($city$apiEndpoint, ['city' => $city->getId()], $specs->spec(), nullnull$response);
  1688.         if ($this->isApiRequest($request)) {
  1689.             return $this->json($result);
  1690.         }
  1691.         return $this->render('ProfileList/list.html.twig', [
  1692.             'profiles' => $result,
  1693.             'source' => $this->source,
  1694.             'source_default' => self::RESULT_SOURCE_BY_PARAMS,
  1695.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  1696.                 'city' => $city->getUriIdentity(),
  1697.                 'priceType' => $priceType,
  1698.                 'minPrice' => $minPrice,
  1699.                 'maxPrice' => $maxPrice,
  1700.                 'page' => $this->getCurrentPageNumber()
  1701.             ]),
  1702.             'recommendationSpec' => $specs->recommendationSpec(),
  1703.         ], response$response);
  1704.     }
  1705.     private function processListByPriceEmptyResult(Page $resultCity $citystring $priceTypeint $minPrice nullint $maxPrice null)
  1706.     {
  1707.         if (!$this->features->fill_empty_profile_list())
  1708.             return $result;
  1709.         $this->source self::RESULT_SOURCE_BY_PARAMS;
  1710.         if ($this->countryCurrencyResolver->getCurrencyFor($city->getCountryCode()) == 'RUB') {
  1711.             if ($minPrice && $maxPrice) {
  1712.                 if ($minPrice == 2000 && $maxPrice == 3000) {
  1713.                     $priceSpec = [
  1714.                         ProfileWithApartmentsOneHourPrice::range(15002000),
  1715.                         ProfileWithApartmentsOneHourPrice::range(30004000),
  1716.                     ];
  1717.                 } else if ($minPrice == 3000 && $maxPrice == 4000) {
  1718.                     $priceSpec = [
  1719.                         ProfileWithApartmentsOneHourPrice::range(20003000),
  1720.                         ProfileWithApartmentsOneHourPrice::range(40005000),
  1721.                     ];
  1722.                 } else if ($minPrice == 4000 && $maxPrice == 5000) {
  1723.                     $priceSpec = [
  1724.                         ProfileWithApartmentsOneHourPrice::range(30004000),
  1725.                         ProfileWithApartmentsOneHourPrice::range(50006000),
  1726.                     ];
  1727.                 } else if ($minPrice == 5000 && $maxPrice == 6000) {
  1728.                     $priceSpec = [
  1729.                         ProfileWithApartmentsOneHourPrice::range(4000999999)
  1730.                     ];
  1731.                 } else {
  1732.                     $priceSpec = [
  1733.                         ProfileWithApartmentsOneHourPrice::range($minPrice$maxPrice)
  1734.                     ];
  1735.                 }
  1736.                 $result $this->listRandomSinglePage($citynullnull$priceSpectruefalse);
  1737.             } elseif ($maxPrice) {
  1738.                 if ($maxPrice == 500) {
  1739.                     $priceSpec ProfileWithApartmentsOneHourPrice::cheaperThan(1500);
  1740.                     $result $this->listRandomSinglePage($citynull$priceSpecnulltruefalse);
  1741.                     if ($result->count() == 0) {
  1742.                         $priceSpec ProfileWithApartmentsOneHourPrice::range(15002000);
  1743.                         $result $this->listRandomSinglePage($citynull$priceSpecnulltruefalse);
  1744.                     }
  1745.                 } else if ($maxPrice == 1500) {
  1746.                     $priceSpec ProfileWithApartmentsOneHourPrice::range(15002000);
  1747.                     $result $this->listRandomSinglePage($citynull$priceSpecnulltruefalse);
  1748.                     if ($result->count() == 0) {
  1749.                         $priceSpec ProfileWithApartmentsOneHourPrice::range(20003000);
  1750.                         $result $this->listRandomSinglePage($citynull$priceSpecnulltruefalse);
  1751.                     }
  1752.                 }
  1753.             } else {
  1754.                 $priceThresholds = new ProfilePriceThresholds($city->getCityPriceCategory(), 'RUB');
  1755.                 switch ($priceType) {
  1756.                     case 'not_expensive':
  1757.                         $priceSpec ProfileWithApartmentsOneHourPrice::cheaperThan(2000);
  1758.                         break;
  1759.                     case 'high':
  1760.                         $priceSpec ProfileWithApartmentsOneHourPrice::range(
  1761.                             $priceThresholds->highMinPrice(),
  1762.                             $priceThresholds->highMaxPrice()
  1763.                         );
  1764.                         break;
  1765.                     case 'low':
  1766.                         $priceSpec ProfileWithApartmentsOneHourPrice::cheaperThan($priceThresholds->lowMaxPrice());
  1767.                         break;
  1768.                     case 'elite':
  1769.                         $priceSpec ProfileWithApartmentsOneHourPrice::moreExpensiveThan($priceThresholds->eliteMinPrice());
  1770.                         break;
  1771.                     default:
  1772.                         throw new \LogicException('Unknown price type');
  1773.                         break;
  1774.                 }
  1775.                 $result $this->listRandomSinglePage($citynull$priceSpecnulltruefalse);
  1776.             }
  1777.         }
  1778.         $result $this->checkEmptyResultNotMasseur($result$citynullself::RESULT_SOURCE_CITY);
  1779.         return $result;
  1780.     }
  1781.     #[ParamConverter("city"converter"city_converter")]
  1782.     #[Route("/api/profiles/listing/city/{city}/age/{ageType}"name"api.profile_listing.by_age"methods"GET"format"json")]
  1783.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  1784.     #[OA\Tag(name"ProfileListing")]
  1785.     #[OA\Response(
  1786.         response200,
  1787.         description'',
  1788.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  1789.     )]
  1790.     public function listByAge(Request $requestCity $citystring $ageTypeint $minAge nullint $maxAge null): Response
  1791.     {
  1792.         $specs $this->profileListSpecificationService->listByAge($ageType$minAge$maxAge);
  1793.         $response = new Response();
  1794.         $apiEndpoint in_array($ageType, ['young''old']) ? '/city/{city}/age/'.$ageType null;
  1795.         $result $this->paginatedListing($city$apiEndpoint, ['city' => $city->getId()], $specs->spec(), nullnull$response);
  1796.         if ($this->isApiRequest($request)) {
  1797.             return $this->json($result);
  1798.         }
  1799.         return $this->render('ProfileList/list.html.twig', [
  1800.             'profiles' => $result,
  1801.             'source' => $this->source,
  1802.             'source_default' => self::RESULT_SOURCE_BY_PARAMS,
  1803.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  1804.                 'city' => $city->getUriIdentity(),
  1805.                 'ageType' => $ageType,
  1806.                 'minAge' => $minAge,
  1807.                 'maxAge' => $maxAge,
  1808.                 'page' => $this->getCurrentPageNumber()
  1809.             ]),
  1810.             'recommendationSpec' => $specs->recommendationSpec(),
  1811.         ], response$response);
  1812.     }
  1813.     private function processListByAgeEmptyResult(Page $resultCity $citystring $ageTypeint $minAge nullint $maxAge null)
  1814.     {
  1815.         if (!$this->features->fill_empty_profile_list())
  1816.             return $result;
  1817.         $this->source self::RESULT_SOURCE_BY_PARAMS;
  1818.         if (in_array($ageType, ['young''old'], true)) {
  1819.             return $result;
  1820.         }
  1821.         if ($minAge && !$maxAge) {
  1822.             $startMinAge $minAge;
  1823.             do {
  1824.                 $startMinAge -= 2;
  1825.                 $ageSpec ProfileWithAge::olderThan($startMinAge);
  1826.                 $result $this->listRandomSinglePage($citynull$ageSpecnulltruefalse);
  1827.             } while ($result->count() == && $startMinAge >= 18);
  1828.         } else if ($ageType == 'young') {
  1829.             $startMaxAge 20;
  1830.             do {
  1831.                 $startMaxAge += 2;
  1832.                 $ageSpec ProfileWithAge::youngerThan($startMaxAge);
  1833.                 $result $this->listRandomSinglePage($citynull$ageSpecnulltruefalse);
  1834.             } while ($result->count() == && $startMaxAge <= 100);
  1835.         }
  1836.         $result $this->checkEmptyResultNotMasseur($result$citynullself::RESULT_SOURCE_CITY);
  1837.         return $result;
  1838.     }
  1839.     #[ParamConverter("city"converter"city_converter")]
  1840.     #[Route("/api/profiles/listing/city/{city}/height/{heightType}"name"api.profile_listing.by_height"methods"GET"format"json")]
  1841.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  1842.     #[OA\Tag(name"ProfileListing")]
  1843.     #[OA\Response(
  1844.         response200,
  1845.         description'',
  1846.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  1847.     )]
  1848.     public function listByHeight(Request $requestCity $citystring $heightType): Response
  1849.     {
  1850.         $specs $this->profileListSpecificationService->listByHeight($heightType);
  1851.         $response = new Response();
  1852.         $result $this->paginatedListing($city'/city/{city}/height/'.$heightType, ['city' => $city->getId()], $specs->spec(), nullself::RESULT_SOURCE_CITY$response);
  1853.         if ($this->isApiRequest($request)) {
  1854.             return $this->json($result);
  1855.         }
  1856.         return $this->render('ProfileList/list.html.twig', [
  1857.             'profiles' => $result,
  1858.             'source' => $this->source,
  1859.             'source_default' => self::RESULT_SOURCE_BY_PARAMS,
  1860.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  1861.                 'city' => $city->getUriIdentity(),
  1862.                 'heightType' => $heightType,
  1863.                 'page' => $this->getCurrentPageNumber()
  1864.             ]),
  1865.             'recommendationSpec' => $specs->recommendationSpec(),
  1866.         ], response$response);
  1867.     }
  1868.     #[ParamConverter("city"converter"city_converter")]
  1869.     #[Route("/api/profiles/listing/city/{city}/breasttype/{breastType}"name"api.profile_listing.by_breast_type"methods"GET"format"json")]
  1870.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  1871.     #[OA\Tag(name"ProfileListing")]
  1872.     #[OA\Response(
  1873.         response200,
  1874.         description'',
  1875.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  1876.     )]
  1877.     public function listByBreastType(Request $requestCity $citystring $breastType): Response
  1878.     {
  1879.         if (null === $type BreastTypes::getValueByUriIdentity($breastType)) {
  1880.             throw $this->createNotFoundException();
  1881.         }
  1882.         $specs $this->profileListSpecificationService->listByBreastType($breastType);
  1883.         $response = new Response();
  1884.         $alternativeSpec $this->getORSpecForItemsArray(BreastTypes::getList(), function($item): ProfileWithBreastType {
  1885.             return new ProfileWithBreastType($item);
  1886.         });
  1887.         $result $this->paginatedListing($city'/city/{city}/breasttype/'.$type, ['city' => $city->getId()], $specs->spec(), $alternativeSpecself::RESULT_SOURCE_BY_PARAMS$response);
  1888.         if ($this->isApiRequest($request)) {
  1889.             return $this->json($result);
  1890.         }
  1891.         return $this->render('ProfileList/list.html.twig', [
  1892.             'profiles' => $result,
  1893.             'source' => $this->source,
  1894.             'source_default' => self::RESULT_SOURCE_BY_PARAMS,
  1895.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  1896.                 'city' => $city->getUriIdentity(),
  1897.                 'breastType' => $breastType,
  1898.                 'page' => $this->getCurrentPageNumber()
  1899.             ]),
  1900.             'recommendationSpec' => $specs->recommendationSpec(),
  1901.         ], response$response);
  1902.     }
  1903.     #[ParamConverter("city"converter"city_converter")]
  1904.     #[Route("/api/profiles/listing/city/{city}/haircolor/{hairColor}"name"api.profile_listing.by_haircolor"methods"GET"format"json")]
  1905.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  1906.     #[OA\Tag(name"ProfileListing")]
  1907.     #[OA\Response(
  1908.         response200,
  1909.         description'',
  1910.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  1911.     )]
  1912.     public function listByHairColor(Request $requestCity $citystring $hairColor): Response
  1913.     {
  1914.         if (null === $color HairColors::getValueByUriIdentity($hairColor)) {
  1915.             throw $this->createNotFoundException();
  1916.         }
  1917.         $specs $this->profileListSpecificationService->listByHairColor($hairColor);
  1918.         $response = new Response();
  1919.         $alternativeSpec $this->getORSpecForItemsArray(HairColors::getList(), function($item): ProfileWithHairColor {
  1920.             return new ProfileWithHairColor($item);
  1921.         });
  1922.         $result $this->paginatedListing($city'/city/{city}/haircolor/'.$color, ['city' => $city->getId()], $specs->spec(), $alternativeSpecself::RESULT_SOURCE_BY_PARAMS$response);
  1923.         if ($this->isApiRequest($request)) {
  1924.             return $this->json($result);
  1925.         }
  1926.         return $this->render('ProfileList/list.html.twig', [
  1927.             'profiles' => $result,
  1928.             'source' => $this->source,
  1929.             'source_default' => self::RESULT_SOURCE_BY_PARAMS,
  1930.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  1931.                 'city' => $city->getUriIdentity(),
  1932.                 'hairColor' => $hairColor,
  1933.                 'page' => $this->getCurrentPageNumber()
  1934.             ]),
  1935.             'recommendationSpec' => $specs->recommendationSpec(),
  1936.         ], response$response);
  1937.     }
  1938.     #[ParamConverter("city"converter"city_converter")]
  1939.     #[Route("/api/profiles/listing/city/{city}/bodytype/{bodyType}"name"api.profile_listing.by_bodytype"methods"GET"format"json")]
  1940.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  1941.     #[OA\Tag(name"ProfileListing")]
  1942.     #[OA\Response(
  1943.         response200,
  1944.         description'',
  1945.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  1946.     )]
  1947.     public function listByBodyType(Request $requestCity $citystring $bodyType): Response
  1948.     {
  1949.         if (null === $type BodyTypes::getValueByUriIdentity($bodyType)) {
  1950.             throw $this->createNotFoundException();
  1951.         }
  1952.         $specs $this->profileListSpecificationService->listByBodyType($bodyType);
  1953.         $response = new Response();
  1954.         $alternativeSpec $this->getORSpecForItemsArray(BodyTypes::getList(), function($item): ProfileWithBodyType {
  1955.             return new ProfileWithBodyType($item);
  1956.         });
  1957.         $result $this->paginatedListing($city'/city/{city}/bodytype/'.$type, ['city' => $city->getId()], $specs->spec(), $alternativeSpecself::RESULT_SOURCE_BY_PARAMS$response);
  1958.         if ($this->isApiRequest($request)) {
  1959.             return $this->json($result);
  1960.         }
  1961.         return $this->render('ProfileList/list.html.twig', [
  1962.             'profiles' => $result,
  1963.             'source' => $this->source,
  1964.             'source_default' => self::RESULT_SOURCE_BY_PARAMS,
  1965.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  1966.                 'city' => $city->getUriIdentity(),
  1967.                 'bodyType' => $bodyType,
  1968.                 'page' => $this->getCurrentPageNumber()
  1969.             ]),
  1970.             'recommendationSpec' => $specs->recommendationSpec(),
  1971.         ], response$response);
  1972.     }
  1973.     #[ParamConverter("city"converter"city_converter")]
  1974.     #[Route("/api/profiles/listing/city/{city}/place/{placeType}"name"api.profile_listing.by_place"methods"GET"format"json")]
  1975.     #[Route("/api/profiles/listing/city/{city}/place/{placeType}/{takeOutLocation}"name"api.profile_listing.by_place.take_out_location"methods"GET"format"json")]
  1976.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  1977.     #[OA\Tag(name"ProfileListing")]
  1978.     #[OA\Response(
  1979.         response200,
  1980.         description'',
  1981.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  1982.     )]
  1983.     public function listByPlace(Request $requestCity $citystring $placeTypestring $takeOutLocation null): Response
  1984.     {
  1985.         if ('take-out' === $placeType && null !== $takeOutLocation && null === TakeOutLocations::getValueByUriIdentity($takeOutLocation)) {
  1986.             throw $this->createNotFoundException();
  1987.         }
  1988.         $specs $this->profileListSpecificationService->listByPlace($placeType$takeOutLocation);
  1989.         if (null === $specs) {
  1990.             throw $this->createNotFoundException();
  1991.         }
  1992.         $response = new Response();
  1993.         $alternativeSpec $this->getORSpecForItemsArray(TakeOutLocations::getList(), function($item): ProfileIsProvidingTakeOut {
  1994.             return new ProfileIsProvidingTakeOut($item);
  1995.         });
  1996.         if ($placeType === 'take-out') {
  1997.             $alternativeSpec->orX(new ProfileHasApartments());
  1998.         }
  1999.         $apiEndpoint '/city/{city}/place/'.$placeType;
  2000.         if (null !== $takeOutLocation) {
  2001.             $apiEndpoint .= '/'.$takeOutLocation;
  2002.         }
  2003.         $result $this->paginatedListing($city$apiEndpoint, ['city' => $city->getId()], $specs->spec(), $alternativeSpecself::RESULT_SOURCE_BY_PARAMS$response);
  2004.         if ($this->isApiRequest($request)) {
  2005.             return $this->json($result);
  2006.         }
  2007.         return $this->render('ProfileList/list.html.twig', [
  2008.             'profiles' => $result,
  2009.             'source' => $this->source,
  2010.             'source_default' => self::RESULT_SOURCE_BY_PARAMS,
  2011.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  2012.                 'city' => $city->getUriIdentity(),
  2013.                 'placeType' => $placeType,
  2014.                 'takeOutLocation' => TakeOutLocations::getUriIdentity(TakeOutLocations::getValueByUriIdentity($takeOutLocation)),
  2015.                 'page' => $this->getCurrentPageNumber()
  2016.             ]),
  2017.             'recommendationSpec' => $specs->recommendationSpec(),
  2018.         ], response$response);
  2019.     }
  2020.     #[ParamConverter("city"converter"city_converter")]
  2021.     #[Route("/api/profiles/listing/city/{city}/privatehaircut/{privateHaircut}"name"api.profile_listing.by_privatehaircut"methods"GET"format"json")]
  2022.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  2023.     #[OA\Tag(name"ProfileListing")]
  2024.     #[OA\Response(
  2025.         response200,
  2026.         description'',
  2027.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  2028.     )]
  2029.     public function listByPrivateHaircut(Request $requestCity $citystring $privateHaircut): Response
  2030.     {
  2031.         if(null === $type PrivateHaircuts::getValueByUriIdentity($privateHaircut))
  2032.             throw $this->createNotFoundException();
  2033.         $specs $this->profileListSpecificationService->listByPrivateHaircut($privateHaircut);
  2034.         $response = new Response();
  2035.         $apiEndpoint '/city/{city}/privatehaircut/'.$type;
  2036.         $alternativeSpec $this->getORSpecForItemsArray(PrivateHaircuts::getList(), function($item): ProfileWithPrivateHaircut {
  2037.             return new ProfileWithPrivateHaircut($item);
  2038.         });
  2039.         $result $this->paginatedListing($city$apiEndpoint, ['city' => $city->getId()], $specs->spec(), $alternativeSpecself::RESULT_SOURCE_BY_PARAMS$response);
  2040.         if ($this->isApiRequest($request)) {
  2041.             return $this->json($result);
  2042.         }
  2043.         return $this->render('ProfileList/list.html.twig', [
  2044.             'profiles' => $result,
  2045.             'source' => $this->source,
  2046.             'source_default' => self::RESULT_SOURCE_BY_PARAMS,
  2047.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  2048.                 'city' => $city->getUriIdentity(),
  2049.                 'privateHaircut' => $privateHaircut,
  2050.                 'page' => $this->getCurrentPageNumber()
  2051.             ]),
  2052.             'recommendationSpec' => $specs->recommendationSpec(),
  2053.         ], response$response);
  2054.     }
  2055.     #[ParamConverter("city"converter"city_converter")]
  2056.     #[Route("/api/profiles/listing/city/{city}/nationality/{nationality}"name"api.profile_listing.by_nationality"methods"GET"format"json")]
  2057.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  2058.     #[OA\Tag(name"ProfileListing")]
  2059.     #[OA\Response(
  2060.         response200,
  2061.         description'',
  2062.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  2063.     )]
  2064.     public function listByNationality(Request $requestCity $citystring $nationality): Response
  2065.     {
  2066.         if (null === $type Nationalities::getValueByUriIdentity($nationality))
  2067.             throw $this->createNotFoundException();
  2068.         $specs $this->profileListSpecificationService->listByNationality($nationality);
  2069.         $response = new Response();
  2070.         $alternativeSpec $this->getORSpecForItemsArray(Nationalities::getList(), function($item): ProfileWithNationality {
  2071.             return new ProfileWithNationality($item);
  2072.         });
  2073.         $apiEndpoint '/city/{city}/nationality/'.$type;
  2074.         $result $this->paginatedListing($city$apiEndpoint, ['city' => $city->getId()], $specs->spec(), $alternativeSpecself::RESULT_SOURCE_BY_PARAMS$response);
  2075.         if ($this->isApiRequest($request)) {
  2076.             return $this->json($result);
  2077.         }
  2078.         return $this->render('ProfileList/list.html.twig', [
  2079.             'profiles' => $result,
  2080.             'source' => $this->source,
  2081.             'source_default' => self::RESULT_SOURCE_BY_PARAMS,
  2082.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  2083.                 'city' => $city->getUriIdentity(),
  2084.                 'nationality' => $nationality,
  2085.                 'page' => $this->getCurrentPageNumber()
  2086.             ]),
  2087.             'recommendationSpec' => $specs->recommendationSpec(),
  2088.         ], response$response);
  2089.     }
  2090.     #[ParamConverter("city"converter"city_converter")]
  2091.     #[ParamConverter("service"options: ['mapping' => ['service' => 'uriIdentity']])]
  2092.     #[Route("/api/profiles/listing/city/{city}/service/{service}"name"api.profile_listing.by_service"methods"GET"format"json")]
  2093.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  2094.     #[OA\Tag(name"ProfileListing")]
  2095.     #[OA\Response(
  2096.         response200,
  2097.         description'',
  2098.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  2099.     )]
  2100.     public function listByProvidedService(Request $requestCity $cityService $service): Response
  2101.     {
  2102.         $specs $this->profileListSpecificationService->listByProvidedService($service$city);
  2103.         $response = new Response();
  2104.         $sameGroupServices $this->serviceRepository->findBy(['group' => $service->getGroup()]);
  2105.         $alternativeSpec $this->getORSpecForItemsArray([$sameGroupServices], function($item): ProfileIsProvidingOneOfServices {
  2106.             return new ProfileIsProvidingOneOfServices($item);
  2107.         });
  2108.         $result $this->paginatedListing($city'/city/{city}/service/{service}', ['city' => $city->getId(), 'service' => $service->getId()], $specs->spec(), $alternativeSpecself::RESULT_SOURCE_SERVICE$response);
  2109.         if ($this->isApiRequest($request)) {
  2110.             return $this->json($result);
  2111.         }
  2112.         return $this->render('ProfileList/list.html.twig', [
  2113.             'profiles' => $result,
  2114.             'source' => $this->source,
  2115.             'source_default' => self::RESULT_SOURCE_SERVICE,
  2116.             'service' => $service,
  2117.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  2118.                 'city' => $city->getUriIdentity(),
  2119.                 'service' => $service->getUriIdentity(),
  2120.                 'page' => $this->getCurrentPageNumber()
  2121.             ]),
  2122.             'recommendationSpec' => $specs->recommendationSpec(),
  2123.         ], response$response);
  2124.     }
  2125.     /**
  2126.      * @Feature("has_archive_page")
  2127.      */
  2128.     #[ParamConverter("city"converter"city_converter")]
  2129.     #[Route("/api/profiles/listing/city/{city}/archive"name"api.profile_listing.archive"methods"GET"format"json")]
  2130.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  2131.     #[OA\Tag(name"ProfileListing")]
  2132.     #[OA\Response(
  2133.         response200,
  2134.         description'',
  2135.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  2136.     )]
  2137.     public function listArchived(Request $requestCity $city): Response
  2138.     {
  2139.         $result $this->profileList->list($citynullnullnullfalsenullProfileList::ORDER_BY_UPDATED);
  2140.         if ($this->isApiRequest($request)) {
  2141.             return $this->json($result);
  2142.         }
  2143.         return $this->render('ProfileList/list.html.twig', [
  2144.             'profiles' => $result,
  2145.             'recommendationSpec' => new \App\Specification\ElasticSearch\ProfileIsNotArchived(), //ProfileIsArchived, согласно https://redminez.net/issues/28305 в реках выводятся неарзивные
  2146.         ]);
  2147.     }
  2148.     #[ParamConverter("city"converter"city_converter")]
  2149.     #[Route("/api/profiles/listing/city/{city}/recent"name"api.profile_listing.recent"methods"GET"format"json")]
  2150.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  2151.     #[OA\Tag(name"ProfileListing")]
  2152.     #[OA\Response(
  2153.         response200,
  2154.         description'',
  2155.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  2156.     )]
  2157.     public function listNew(Request $requestCity $cityint $weeks 2): Response
  2158.     {
  2159.         $specs $this->profileListSpecificationService->listNew($weeks);
  2160.         $response = new Response();
  2161.         $result $this->paginatedListing($city'/city/{city}/recent', ['city' => $city->getId()], $specs->spec(), nullnull$response);
  2162.         if ($this->isApiRequest($request)) {
  2163.             return $this->json($result);
  2164.         }
  2165.         return $this->render('ProfileList/list.html.twig', [
  2166.             'profiles' => $result,
  2167.             'recommendationSpec' => $specs->recommendationSpec(),
  2168.         ], response$response);
  2169.     }
  2170.     #[ParamConverter("city"converter"city_converter")]
  2171.     #[Route("/api/profiles/listing/city/{city}/noretouch"name"api.profile_listing.noretouch"methods"GET"format"json")]
  2172.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  2173.     #[OA\Tag(name"ProfileListing")]
  2174.     #[OA\Response(
  2175.         response200,
  2176.         description'',
  2177.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  2178.     )]
  2179.     public function listByNoRetouch(Request $requestCity $city): Response
  2180.     {
  2181.         $specs $this->profileListSpecificationService->listByNoRetouch();
  2182.         $response = new Response();
  2183.         $result $this->paginatedListing($city'/city/{city}/noretouch', ['city' => $city->getId()], $specs->spec(), nullself::RESULT_SOURCE_CITY$response);
  2184.         if ($this->isApiRequest($request)) {
  2185.             return $this->json($result);
  2186.         }
  2187.         return $this->render('ProfileList/list.html.twig', [
  2188.             'profiles' => $result,
  2189.             'profiles_count' => $result->count(),
  2190.             'source' => $this->source,
  2191.             'recommendationSpec' => $specs->recommendationSpec(),
  2192.         ], response$response);
  2193.     }
  2194.     #[ParamConverter("city"converter"city_converter")]
  2195.     #[Route("/api/profiles/listing/city/{city}/nice"name"api.profile_listing.nice"methods"GET"format"json")]
  2196.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  2197.     #[OA\Tag(name"ProfileListing")]
  2198.     #[OA\Response(
  2199.         response200,
  2200.         description'',
  2201.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  2202.     )]
  2203.     public function listByNice(Request $requestCity $city): Response
  2204.     {
  2205.         $specs $this->profileListSpecificationService->listByNice();
  2206.         $response = new Response();
  2207.         $result $this->paginatedListing($city'/city/{city}/nice', ['city' => $city->getId()], $specs->spec(), nullself::RESULT_SOURCE_CITY$response);
  2208.         if ($this->isApiRequest($request)) {
  2209.             return $this->json($result);
  2210.         }
  2211.         return $this->render('ProfileList/list.html.twig', [
  2212.             'profiles' => $result,
  2213.             'source' => $this->source,
  2214.             'recommendationSpec' => $specs->recommendationSpec(),
  2215.         ], response$response);
  2216.     }
  2217.     #[ParamConverter("city"converter"city_converter")]
  2218.     #[Route("/api/profiles/listing/city/{city}/oncall"name"api.profile_listing.oncall"methods"GET"format"json")]
  2219.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  2220.     #[OA\Tag(name"ProfileListing")]
  2221.     #[OA\Response(
  2222.         response200,
  2223.         description'',
  2224.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  2225.     )]
  2226.     public function listByOnCall(Request $requestCity $city): Response
  2227.     {
  2228.         $specs $this->profileListSpecificationService->listByOnCall();
  2229.         $response = new Response();
  2230.         $result $this->paginatedListing($city'/city/{city}/oncall', ['city' => $city->getId()], $specs->spec(), nullself::RESULT_SOURCE_CITY$response);
  2231.         if ($this->isApiRequest($request)) {
  2232.             return $this->json($result);
  2233.         }
  2234.         return $this->render('ProfileList/list.html.twig', [
  2235.             'profiles' => $result,
  2236.             'source' => $this->source,
  2237.             'recommendationSpec' => $specs->recommendationSpec(),
  2238.         ], response$response);
  2239.     }
  2240.     #[ParamConverter("city"converter"city_converter")]
  2241.     #[Route("/api/profiles/listing/city/{city}/fornight"name"api.profile_listing.fornight"methods"GET"format"json")]
  2242.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  2243.     #[OA\Tag(name"ProfileListing")]
  2244.     #[OA\Response(
  2245.         response200,
  2246.         description'',
  2247.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  2248.     )]
  2249.     public function listForNight(Request $requestCity $city): Response
  2250.     {
  2251.         $specs $this->profileListSpecificationService->listForNight();
  2252.         $response = new Response();
  2253.         $result $this->paginatedListing($city'/city/{city}/fornight', ['city' => $city->getId()], $specs->spec(), nullself::RESULT_SOURCE_CITY$response);
  2254.         if ($this->isApiRequest($request)) {
  2255.             return $this->json($result);
  2256.         }
  2257.         return $this->render('ProfileList/list.html.twig', [
  2258.             'profiles' => $result,
  2259.             'source' => $this->source,
  2260.             'recommendationSpec' => $specs->recommendationSpec(),
  2261.         ], response$response);
  2262.     }
  2263.     private function getSpecForEliteGirls(City $city): Filter
  2264.     {
  2265.         $minPrice $this->countryCurrencyResolver->getValueByCountryCode($city->getCountryCode(), [
  2266.             'RUB' => 5000,
  2267.             'UAH' => 1500,
  2268.             'USD' => 100,
  2269.             'EUR' => 130,
  2270.         ]);
  2271.         return new ProfileIsElite($minPrice);
  2272.     }
  2273.     private function getElasticSearchSpecForEliteGirls(City $city): ISpecification
  2274.     {
  2275.         $minPrice $this->countryCurrencyResolver->getValueByCountryCode($city->getCountryCode(), [
  2276.             'RUB' => 5000,
  2277.             'UAH' => 1500,
  2278.             'USD' => 100,
  2279.             'EUR' => 130,
  2280.         ]);
  2281.         return new \App\Specification\ElasticSearch\ProfileIsElite($minPrice);
  2282.     }
  2283.     #[ParamConverter("city"converter"city_converter")]
  2284.     #[Route("/api/profiles/listing/city/{city}/elite"name"api.profile_listing.elite"methods"GET"format"json")]
  2285.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  2286.     #[OA\Tag(name"ProfileListing")]
  2287.     #[OA\Response(
  2288.         response200,
  2289.         description'',
  2290.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  2291.     )]
  2292.     public function listForEliteGirls(CountryCurrencyResolver $countryCurrencyResolverRequest $requestCity $city): Response
  2293.     {
  2294.         $specs $this->profileListSpecificationService->listForEliteGirls($city);
  2295.         $response = new Response();
  2296.         $result $this->paginatedListing($city'/city/{city}/elite', ['city' => $city->getId()], $specs->spec(), nullnull$response);
  2297.         if ($this->isApiRequest($request)) {
  2298.             return $this->json($result);
  2299.         }
  2300.         return $this->render('ProfileList/list.html.twig', [
  2301.             'profiles' => $result,
  2302.             'source' => $this->source,
  2303.             'source_default' => self::RESULT_SOURCE_BY_PARAMS,
  2304.             'category_url' => $this->generateUrl($request->attributes->get('_route'), [
  2305.                 'city' => $city->getUriIdentity(),
  2306.                 'page' => $this->getCurrentPageNumber()
  2307.             ]),
  2308.             'recommendationSpec' => $specs->recommendationSpec(),
  2309.         ], response$response);
  2310.     }
  2311.     #[ParamConverter("city"converter"city_converter")]
  2312.     #[Route("/api/profiles/listing/city/{city}/realelite"name"api.profile_listing.real_elite"methods"GET"format"json")]
  2313.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  2314.     #[OA\Tag(name"ProfileListing")]
  2315.     #[OA\Response(
  2316.         response200,
  2317.         description'',
  2318.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  2319.     )]
  2320.     public function listForRealElite(Request $requestCountryCurrencyResolver $countryCurrencyResolverCity $city): Response
  2321.     {
  2322.         $specs $this->profileListSpecificationService->listForRealElite($city);
  2323.         $response = new Response();
  2324.         $result $this->paginatedListing($city'/city/{city}/realelite', ['city' => $city->getId()], $specs->spec(), nullself::RESULT_SOURCE_CITY$response);
  2325.         if ($this->isApiRequest($request)) {
  2326.             return $this->json($result);
  2327.         }
  2328.         return $this->render('ProfileList/list.html.twig', [
  2329.             'profiles' => $result,
  2330.             'source' => $this->source,
  2331.             'recommendationSpec' => $specs->recommendationSpec(),
  2332.         ], response$response);
  2333.     }
  2334.     #[ParamConverter("city"converter"city_converter")]
  2335.     #[Route("/api/profiles/listing/city/{city}/vip"name"api.profile_listing.vip"methods"GET"format"json")]
  2336.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  2337.     #[OA\Tag(name"ProfileListing")]
  2338.     #[OA\Response(
  2339.         response200,
  2340.         description'',
  2341.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  2342.     )]
  2343.     public function listForVipPros(Request $requestCountryCurrencyResolver $countryCurrencyResolverCity $city): Response
  2344.     {
  2345.         $specs $this->profileListSpecificationService->listForVipPros($city);
  2346.         $response = new Response();
  2347.         $result $this->paginatedListing($city'/city/{city}/vip', ['city' => $city->getId()], $specs->spec(), nullself::RESULT_SOURCE_CITY$response);
  2348.         if ($this->isApiRequest($request)) {
  2349.             return $this->json($result);
  2350.         }
  2351.         return $this->render('ProfileList/list.html.twig', [
  2352.             'profiles' => $result,
  2353.             'source' => $this->source,
  2354.             'recommendationSpec' => $specs->recommendationSpec(),
  2355.         ], response$response);
  2356.     }
  2357.     #[ParamConverter("city"converter"city_converter")]
  2358.     #[Route("/api/profiles/listing/city/{city}/vipindi"name"api.profile_listing.vipindi"methods"GET"format"json")]
  2359.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  2360.     #[OA\Tag(name"ProfileListing")]
  2361.     #[OA\Response(
  2362.         response200,
  2363.         description'',
  2364.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  2365.     )]
  2366.     public function listForVipIndividual(Request $requestCountryCurrencyResolver $countryCurrencyResolverCity $city): Response
  2367.     {
  2368.         $specs $this->profileListSpecificationService->listForVipIndividual($city);
  2369.         $response = new Response();
  2370.         $result $this->paginatedListing($city'/city/{city}/vipindi', ['city' => $city->getId()], $specs->spec(), nullself::RESULT_SOURCE_CITY$response);
  2371.         if ($this->isApiRequest($request)) {
  2372.             return $this->json($result);
  2373.         }
  2374.         return $this->render('ProfileList/list.html.twig', [
  2375.             'profiles' => $result,
  2376.             'source' => $this->source,
  2377.             'recommendationSpec' => $specs->recommendationSpec(),
  2378.         ], response$response);
  2379.     }
  2380.     #[ParamConverter("city"converter"city_converter")]
  2381.     #[Route("/api/profiles/listing/city/{city}/vipgirls"name"api.profile_listing.vipgirls"methods"GET"format"json")]
  2382.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  2383.     #[OA\Tag(name"ProfileListing")]
  2384.     #[OA\Response(
  2385.         response200,
  2386.         description'',
  2387.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  2388.     )]
  2389.     public function listForVipGirlsCity(Request $requestCity $city): Response
  2390.     {
  2391.         $specs $this->profileListSpecificationService->listForVipGirlsCity($city);
  2392.         $response = new Response();
  2393.         $result $this->paginatedListing($citynull, [], $specs->spec(), nullself::RESULT_SOURCE_CITY$response);
  2394.         if ($this->isApiRequest($request)) {
  2395.             return $this->json($result);
  2396.         }
  2397.         return $this->render('ProfileList/list.html.twig', [
  2398.             'profiles' => $result,
  2399.             'source' => $this->source,
  2400.             'recommendationSpec' => $specs->recommendationSpec(),
  2401.         ], response$response);
  2402.     }
  2403.     #[ParamConverter("city"converter"city_converter")]
  2404.     #[Route("/api/profiles/listing/city/{city}/girlfriends"name"api.profile_listing.girlfriends"methods"GET"format"json")]
  2405.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  2406.     #[OA\Tag(name"ProfileListing")]
  2407.     #[OA\Response(
  2408.         response200,
  2409.         description'',
  2410.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  2411.     )]
  2412.     public function listOfGirlfriends(Request $requestCity $city): Response
  2413.     {
  2414.         $specs $this->profileListSpecificationService->listOfGirlfriends();
  2415.         $response = new Response();
  2416.         $result $this->paginatedListing($citynull, [], $specs->spec(), nullself::RESULT_SOURCE_CITY$response);
  2417.         if ($this->isApiRequest($request)) {
  2418.             return $this->json($result);
  2419.         }
  2420.         return $this->render('ProfileList/list.html.twig', [
  2421.             'profiles' => $result,
  2422.             'source' => $this->source,
  2423.             'recommendationSpec' => $specs->recommendationSpec(),
  2424.         ]);
  2425.     }
  2426.     #[ParamConverter("city"converter"city_converter")]
  2427.     #[Route("/api/profiles/listing/city/{city}/most_expensive"name"api.profile_listing.most_expensive"methods"GET"format"json")]
  2428.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  2429.     #[OA\Tag(name"ProfileListing")]
  2430.     #[OA\Response(
  2431.         response200,
  2432.         description'',
  2433.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  2434.     )]
  2435.     public function listOfMostExpensive(Request $requestCity $city): Response
  2436.     {
  2437.         $specs $this->profileListSpecificationService->listOfMostExpensive($city);
  2438.         $response = new Response();
  2439.         $result $this->paginatedListing($citynull, [], $specs->spec(), nullself::RESULT_SOURCE_CITY$response);
  2440.         if ($this->isApiRequest($request)) {
  2441.             return $this->json($result);
  2442.         }
  2443.         return $this->render('ProfileList/list.html.twig', [
  2444.             'profiles' => $result,
  2445.             'source' => $this->source,
  2446.             'recommendationSpec' => $specs->recommendationSpec(),
  2447.         ]);
  2448.     }
  2449.     #[ParamConverter("city"converter"city_converter")]
  2450.     #[Route("/api/profiles/listing/city/{city}/bdsm"name"api.profile_listing.bdsm"methods"GET"format"json")]
  2451.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  2452.     #[OA\Tag(name"ProfileListing")]
  2453.     #[OA\Response(
  2454.         response200,
  2455.         description'',
  2456.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  2457.     )]
  2458.     public function listBdsm(Request $requestCity $cityServiceRepository $serviceRepositoryParameterBagInterface $parameterBag): Response
  2459.     {
  2460.         $specs $this->profileListSpecificationService->listBdsm();
  2461.         $response = new Response();
  2462.         $result $this->paginatedListing($city'/city/{city}/bdsm', ['city' => $city->getId()], $specs->spec(), nullnull$response);
  2463.         if ($this->isApiRequest($request)) {
  2464.             return $this->json($result);
  2465.         }
  2466.         return $this->render('ProfileList/list.html.twig', [
  2467.             'profiles' => $result,
  2468.             'recommendationSpec' => $specs->recommendationSpec(),
  2469.         ], response$response);
  2470.     }
  2471.     #[ParamConverter("city"converter"city_converter")]
  2472.     #[Route("/api/profiles/listing/city/{city}/gender/{gender}"name"api.profile_listing.by_gender"methods"GET"format"json")]
  2473.     #[OA\Parameter(name"page"in"query"schema: new OA\Schema(type"integer", default: 1minimum1))]
  2474.     #[OA\Tag(name"ProfileListing")]
  2475.     #[OA\Response(
  2476.         response200,
  2477.         description'',
  2478.         content: new OA\JsonContent(ref"#/components/schemas/ProfileListingPage")
  2479.     )]
  2480.     public function listByGender(Request $requestCity $citystring $genderDefaultCityProvider $defaultCityProvider): Response
  2481.     {
  2482.         if ($city->getId() != $defaultCityProvider->getDefaultCity()->getId()) {
  2483.             throw $this->createNotFoundException();
  2484.         }
  2485.         if (null === Genders::getValueByUriIdentity($gender))
  2486.             throw $this->createNotFoundException();
  2487.         $specs $this->profileListSpecificationService->listByGender($gender);
  2488.         $response = new Response();
  2489.         $result $this->paginatedListing($citynull, [], $specs->spec(), nullnull$response);
  2490.         if ($this->isApiRequest($request)) {
  2491.             return $this->json($result);
  2492.         }
  2493.         return $this->render('ProfileList/list.html.twig', [
  2494.             'profiles' => $result,
  2495.             'recommendationSpec' => $specs->recommendationSpec(),
  2496.         ]);
  2497.     }
  2498.     /**
  2499.      * Сейчас не используется, решили доставать их всех соседних подкатегорий разом.
  2500.      * Пока оставил, вдруг передумают.
  2501.      * @deprecated
  2502.      */
  2503.     public function listByNextSimilarCategories(callable $listMethod$requestCategory, array $similarItems): ORMQueryResult
  2504.     {
  2505.         $similarItems array_filter($similarItems, function ($item) use ($requestCategory): bool {
  2506.             return $item != $requestCategory;
  2507.         });
  2508.         //shuffle($similarItems);
  2509.         $item null;
  2510.         $result null;
  2511.         do {
  2512.             $item $item == null current($similarItems) : next($similarItems);
  2513.             if (false === $item)
  2514.                 return $result;
  2515.             $result $listMethod($item);
  2516.         } while ($result->count() == 0);
  2517.         return $result;
  2518.     }
  2519.     private function shouldShowHomepageCityListingsBlock(City $cityint $pagebool $subRequest): bool
  2520.     {
  2521.         if ($page !== 1) {
  2522.             return false;
  2523.         }
  2524.         if ($subRequest) {
  2525.             return true;
  2526.         }
  2527.         return !$city->equals($this->parameterBag->get('default_city'));
  2528.     }
  2529.     protected function getCurrentPageNumber(): int
  2530.     {
  2531.         $page = (int) $this->requestStack->getCurrentRequest()?->get($this->pageParameter1);
  2532.         if ($page 1) {
  2533.             $page 1;
  2534.         }
  2535.         return $page;
  2536.     }
  2537.     protected function render(string $view, array $parameters = [], Response $response null): Response
  2538.     {
  2539.         $parameters $this->fillListingWithRecommendations($parameters);
  2540.         $this->listingService->setCurrentListingPage($parameters['profiles']);
  2541.         $requestAttrs $this->requestStack->getCurrentRequest();
  2542.         if (isset($parameters['profiles']) && is_object($parameters['profiles']) && method_exists($parameters['profiles'], 'totalCount')) {
  2543.             $requestAttrs->attributes->set('profiles_count'$parameters['profiles']->totalCount());
  2544.         }
  2545.         $listing $requestAttrs->get('_controller');
  2546.         $listing is_array($listing) ? $listing[count($listing) - 1] : $listing;
  2547.         $listing preg_replace('/[^:]+::/'''$listing);
  2548.         $listingParameters $requestAttrs->get('_route_params');
  2549.         $listingParameters is_array($listingParameters) ? $listingParameters : [];
  2550.         $mainRequestHasPageParam = isset(($this->requestStack->getMainRequest()->get('_route_params') ?? [])['page']);
  2551.         if ($this->requestStack->getCurrentRequest()->isXmlHttpRequest()) {
  2552.             $view = (
  2553.                 str_starts_with($listing'list')
  2554.                 && 'ProfileList/list.html.twig' === $view
  2555.                 && $mainRequestHasPageParam //isset($listingParameters['page'])
  2556.             )
  2557.                 ? 'ProfileList/list.profiles.html.twig'
  2558.                 $view;
  2559.             return $this->prepareForXhr(parent::render($view$parameters$response));
  2560.             //return $this->getJSONResponse($parameters);
  2561.         } else {
  2562.             $parameters $this->prepareSsrRecommendedProfiles($parameters);
  2563.             $parameters array_merge($parameters, [
  2564.                 'listing' => $listing,
  2565.                 'listing_parameters' => $listingParameters,
  2566.             ]);
  2567.             return parent::render($view$parameters$response);
  2568.         }
  2569.     }
  2570.     private function fillListingWithRecommendations(array $parameters): array
  2571.     {
  2572.         $parameters['recommendations_fill_applied'] = $parameters['recommendations_fill_applied'] ?? false;
  2573.         if (!($parameters['profiles'] ?? null) instanceof Page) {
  2574.             return $parameters;
  2575.         }
  2576.         $city $this->requestStack->getCurrentRequest()?->attributes->get('city');
  2577.         if (!$city instanceof City) {
  2578.             return $parameters;
  2579.         }
  2580.         $filled $this->profileListingRecommendationsFiller->fill(
  2581.             $city,
  2582.             $parameters['profiles'],
  2583.             $this->resolveRecommendationGenders(),
  2584.         );
  2585.         $parameters['profiles'] = $filled['profiles'];
  2586.         $parameters['recommendations_fill_applied'] = $filled['applied'];
  2587.         $parameters['recommendations_fill_original_count'] = $filled['original_count'];
  2588.         $parameters['excludeRecommendationProfileIds'] = array_values(array_unique(array_merge(
  2589.             $parameters['excludeRecommendationProfileIds'] ?? [],
  2590.             $filled['visible_profile_ids'] ?? [],
  2591.         )));
  2592.         return $parameters;
  2593.     }
  2594.     private function prepareSsrRecommendedProfiles(array $parameters): array
  2595.     {
  2596.         if (!empty($parameters['recommendations_fill_applied'])) {
  2597.             return $parameters;
  2598.         }
  2599.         if (isset($parameters['ssr_recommended_profiles']) || !($parameters['profiles'] ?? null) instanceof Page) {
  2600.             return $parameters;
  2601.         }
  2602.         $city $this->requestStack->getCurrentRequest()?->attributes->get('city');
  2603.         if (!$city instanceof City) {
  2604.             return $parameters;
  2605.         }
  2606.         $parameters['ssr_recommended_profiles'] = $this->profileListingRecommendationsFiller->popularProfilesForBlock(
  2607.             $city,
  2608.             $parameters['profiles'],
  2609.             $this->resolveRecommendationGenders(),
  2610.             5,
  2611.             $parameters['excludeRecommendationProfileIds'] ?? [],
  2612.         );
  2613.         return $parameters;
  2614.     }
  2615.     private function resolveRecommendationGenders(): array
  2616.     {
  2617.         $gender $this->requestStack->getCurrentRequest()?->attributes->get('gender');
  2618.         if (is_string($gender) && null !== Genders::getValueByUriIdentity($gender)) {
  2619.             return [Genders::getValueByUriIdentity($gender)];
  2620.         }
  2621.         return [Genders::FEMALE];
  2622.     }
  2623.     private function listActiveWithinCityOrderedByStatusWithSpecAvoidingTopPlacementLimited(
  2624.         City $city,
  2625.         ?Filter $spec,
  2626.         array $additionalSpecs null,
  2627.         array $genders = [Genders::FEMALE],
  2628.         int $limit 0,
  2629.     ): array|Page {
  2630.         return $this->profileList->listActiveWithinCityOrderedByStatusWithSpecLimited($city$spec$additionalSpecs$genderstrue$limit);
  2631.     }
  2632.     private function listRandomSinglePage(
  2633.         City $city,
  2634.         ?string $country,
  2635.         ?Filter $spec,
  2636.         ?array $additionalSpecs,
  2637.         bool $active,
  2638.         ?bool $masseur false,
  2639.         array $genders = [Genders::FEMALE]
  2640.     ): Page {
  2641.         return $this->profileList->listRandom($city$country$spec$additionalSpecs$active$masseur$genderstrue);
  2642.     }
  2643.     private function shuffleProfilesOnPage(Page $result): Page
  2644.     {
  2645.         $profiles iterator_to_array($result->getIterator());
  2646.         if(count($profiles) > 1) {
  2647.             shuffle($profiles);
  2648.         }
  2649.         return new FakeORMQueryPage(
  2650.             $result->getCurrentOffset(),
  2651.             $result->getCurrentPage(),
  2652.             $result->getCurrentLimit(),
  2653.             $result->totalCount(),
  2654.             $profiles
  2655.         );
  2656.     }
  2657.     /**
  2658.      * Достает из списка анкет их id с учетом совместимости разных форматов данных
  2659.      */
  2660.     private function extractProfileIds(array $profiles): array
  2661.     {
  2662.         $ids array_map(static function ($item) {
  2663.             /**
  2664.              * - array - данные из микросервиса ротации через API
  2665.              * - Profile::getId() - полноценная сущность анкеты
  2666.              * - ProfileListingReadModel::$id - read-model анкеты
  2667.              */
  2668.             return is_array($item) ? $item['id'] : ($item?->id ?? $item?->getId());
  2669.         }, $profiles);
  2670.         return array_filter($ids); // remove null values
  2671.     }
  2672. //    protected function getJSONResponse(array $parameters)
  2673. //    {
  2674. //        $request = $this->request;
  2675. //        $data = json_decode($request->getContent(), true);
  2676. //
  2677. //        $imageSize = !empty($data['imageSize']) ? $data['imageSize'] : "357x500";
  2678. //
  2679. //        /** @var FakeORMQueryPage $queryPage */
  2680. //        $queryPage = $parameters['profiles'];
  2681. //
  2682. //        $profiles = array_map(function(ProfileListingReadModel $profile) use ($imageSize) {
  2683. //            $profile->stations = array_values($profile->stations);
  2684. //            $profile->avatar['path'] = $this->responsiveAssetsService->getResponsiveImageUrl($profile->avatar['path'], 'profile_media', $imageSize, 'jpg');
  2685. //            $profile->uri = $this->generateUrl('profile_preview.page', ['city' => $profile->city->uriIdentity, 'profile' => $profile->uriIdentity]);
  2686. //            return $profile;
  2687. //        }, $queryPage->getArray());
  2688. //
  2689. //        return new JsonResponse([
  2690. //            'profiles' => $profiles,
  2691. //            'currentPage' => $queryPage->getCurrentPage(),
  2692. //        ], Response::HTTP_OK);
  2693. //    }
  2694. }