src/Controller/ProfileListController.php line 840

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