src/Service/Entry/FrontService.php line 251

Open in your IDE?
  1. <?php
  2. /**
  3.  * EntryのHotel/Workspace/Activity/Mobilityの一覧取得と検索を行う
  4.  */
  5. namespace App\Service\Entry;
  6. use App\Entity\Entry\Actibity;
  7. use App\Entity\Entry\Entry;
  8. use App\Entity\Entry\Hotel;
  9. use App\Entity\Entry\ModelPlan;
  10. use App\Entity\Entry\Workspace;
  11. use App\Entity\Master\Area;
  12. use App\Entity\Master\Equipment;
  13. use App\Entity\Master\Service;
  14. use App\Entity\Master\Tag;
  15. use App\Entity\Master\Target;
  16. use App\Repository\Entry\EntryRepository;
  17. use App\Utils\GetQueryUtilTrait;
  18. use App\Utils\PaginationUtil;
  19. use App\Utils\TargetChoiceUtil;
  20. use Doctrine\ORM\EntityManagerInterface;
  21. use Doctrine\ORM\QueryBuilder;
  22. use Symfony\Component\HttpFoundation\Request;
  23. class FrontService
  24. {
  25.     use GetQueryUtilTrait;
  26.     private EntityManagerInterface $em;
  27.     private EntryRepository $entryRepository;
  28.     private ?int $type null;
  29.     private string $locale;
  30.     public function __construct(
  31.         EntityManagerInterface $em,
  32.         EntryRepository $entryRepository
  33.     ) {
  34.         $this->em $em;
  35.         $this->entryRepository $entryRepository;
  36.     }
  37.     /**
  38.      * 実行するエントリーのカテゴリを指定
  39.      * モデルプランは指定できない
  40.      * 2度は指定できない
  41.      *
  42.      * @param int $type
  43.      * @return $this
  44.      * @throws \Exception
  45.      */
  46.     public function setType(int $type): self
  47.     {
  48.         if(null !== $this->type) {
  49.             throw new \Exception('setType() method call only once');
  50.         }
  51.         switch(true) {
  52.             case TargetChoiceUtil::inModelPlan($type):
  53.             case TargetChoiceUtil::inHotel($type):
  54.             case TargetChoiceUtil::inWorkspace($type):
  55.                 $this->type $type;
  56.                 return $this;
  57.             case TargetChoiceUtil::inActivity($type):
  58.             case TargetChoiceUtil::inMobility($type):
  59.                 $this->type TargetChoiceUtil::ACTIVITY;
  60.                 return $this;
  61.         }
  62.         throw new \InvalidArgumentException("type invalid");
  63.     }
  64.     /**
  65.      * 現在の言語を指定
  66.      * @param string $locale
  67.      * @return $this
  68.      */
  69.     public function setLocale(string $locale): self
  70.     {
  71.         if(!in_array($locale, ["ja""en""cn""tw"], true)) {
  72.             $locale "ja";
  73.         }
  74.         $this->locale $locale;
  75.         return $this;
  76.     }
  77.     private function createResumeSessionName(): string
  78.     {
  79.         return sprintf("entry_list_resume_%s"$this->type);
  80.     }
  81.     /**
  82.      * 選択項目データを今回のカテゴリーに基づいて返す
  83.      *
  84.      * @return array|array[]
  85.      */
  86.     public function getFilter(): array
  87.     {
  88.         switch($this->type) {
  89.             case TargetChoiceUtil::MODELPLAN:
  90.                 return $this->getModelPlanFilter();
  91.             case TargetChoiceUtil::HOTEL:
  92.                 return $this->getHotelFilter();
  93.             case TargetChoiceUtil::WORKSPACE:
  94.                 return $this->getWorkSpaceFilter();
  95.             case TargetChoiceUtil::ACTIVITY:
  96.             case TargetChoiceUtil::MOBILITY:
  97.                 return $this->getActivityFilter();
  98.         }
  99.         throw new \InvalidArgumentException('type unset. call setType() before.');
  100.     }
  101.     protected function getModelPlanFilter(): array
  102.     {
  103.         return [
  104.             "Area" => $this->getAreaChoice(),
  105.             "Equipment" => $this->getChoice(Equipment::class),
  106.             "Service" => $this->getChoice(Service::class),
  107.             "Target" => $this->getChoice(Target::class),
  108.             "Tag" => $this->getChoice(Tag::class, function(Tag $value) {
  109.                 return $value->getCategoryLocaleName($this->locale);
  110.             }),
  111.         ];
  112.     }
  113.     protected function getHotelFilter(): array
  114.     {
  115.         return [
  116.             "Area" => $this->getAreaChoice(),
  117.             "Equipment" => $this->getChoice(Equipment::class),
  118.             "Service" => $this->getChoice(Service::class),
  119.             "Target" => $this->getChoice(Target::class)
  120.         ];
  121.     }
  122.     protected function getWorkSpaceFilter(): array
  123.     {
  124.         return [
  125.             "Area" => $this->getAreaChoice(),
  126.             "Equipment" => $this->getChoice(Equipment::class),
  127.             "Service" => $this->getChoice(Service::class)
  128.         ];
  129.     }
  130.     protected function getActivityFilter(): array
  131.     {
  132.         return [
  133.             "Area" => $this->getAreaChoice(),
  134.             "Service" => $this->getChoice(Service::class),
  135.             "Tag" => $this->getChoice(Tag::class, function(Tag $value) {
  136.                 return $value->getCategoryLocaleName($this->locale);
  137.             }),
  138.             "Target" => $this->getChoice(Target::class),
  139.             "Category" => [
  140.                 "choice" => null,
  141.                 "choices" => [
  142.                     "_all" => [
  143.                         TargetChoiceUtil::ACTIVITY => [
  144.                             "label" => TargetChoiceUtil::localeName(TargetChoiceUtil::ACTIVITY$this->locale),
  145.                             "choice" => false
  146.                         ],
  147.                         TargetChoiceUtil::MOBILITY => [
  148.                             "label" => TargetChoiceUtil::localeName(TargetChoiceUtil::MOBILITY$this->locale),
  149.                             "choice" => false
  150.                         ]
  151.                     ]
  152.                 ]
  153.             ]
  154.         ];
  155.     }
  156.     private function getAreaChoice(): array
  157.     {
  158.         $area = new Area();
  159.         $names = [
  160.             "_all" => []
  161.         ];
  162.         foreach($area->getLocaleAreaMapArray($this->locale) as $id => $name) {
  163.             $names["_all"][$id] = [
  164.                 "label" => $name,
  165.                 "choice" => false
  166.             ];
  167.         }
  168.         return [
  169.             "choice" => null,
  170.             "choices" => $names
  171.         ];
  172.     }
  173.     private function getChoice(string $className, ?callable $groupingFunction null): array
  174.     {
  175.         $repository $this->em->getRepository($className);
  176.         $qb $repository->getKeyValueQueryForCategory($this->type);
  177.         return $this->createChoiceArray($qb->getQuery()->getResult(), $groupingFunction);
  178.     }
  179.     private function createChoiceArray(array $result, ?callable $groupingFunction null): array
  180.     {
  181.         $choices = [];
  182.         foreach($result as $value) {
  183.             if(null === $groupingFunction) {
  184.                 $group "_all";
  185.             } else {
  186.                 $group $groupingFunction($value);
  187.             }
  188.             if(!isset($choices[$group])) {
  189.                 $choices[$group] = [];
  190.             }
  191.             $choices[$group][$value->getId()] = [
  192.                 "label" => $value->getLocaleName($this->locale),
  193.                 "entity" => $value,
  194.                 "choice" => false
  195.             ];
  196.         }
  197.         return [
  198.             "choice" => null,
  199.             "choices" => $choices
  200.         ];
  201.     }
  202.     /**
  203.      * Request queryから選択データを取得する
  204.      * @param Request $request
  205.      * @return array
  206.      */
  207.     public function getCriteriaFromRequest(Request $request): array
  208.     {
  209.         $criteria = [];
  210.         if($area $this->getSingleQuery($request"area")) {
  211.             $criteria['area'] = $area;
  212.         }
  213.         if($target $this->getMultiQuery($request"target")) {
  214.             $criteria['target'] = $target;
  215.         }
  216.         if($equipment $this->getMultiQuery($request"equipment")) {
  217.             $criteria['equipment'] = $equipment;
  218.         }
  219.         if($service $this->getMultiQuery($request'service')) {
  220.             $criteria['service'] = $service;
  221.         }
  222.         if($tag $this->getMultiQuery($request'tag')) {
  223.             $criteria['tag'] = $tag;
  224.         }
  225.         if($mode $this->getSingleQuery($request"category")) {
  226.             $criteria["category"] = $mode;
  227.         }
  228.         if($page $this->getSingleQuery($request"page")) {
  229.             $criteria['page'] = $page;
  230.         } else {
  231.             $criteria['page'] = 1;
  232.         }
  233.         $request->getSession()->set($this->createResumeSessionName(), $criteria);
  234.         return $criteria;
  235.     }
  236.     public function getCriteriaFromSession(Request $request): array
  237.     {
  238.         $criteria $request->getSession()->get($this->createResumeSessionName());
  239.         if(!$criteria) return [];
  240.         return $criteria;
  241.     }
  242.     /**
  243.      * getFilter()で取得した選択肢データにリクエストなどで受け取った選択情報をアサインしていく
  244.      *
  245.      * @param array $filter
  246.      * @param array $criteria
  247.      * @return array
  248.      */
  249.     public function handleRequest(array $filter, array $criteria): array
  250.     {
  251.         $filter $this->handleAreaRequest($filter$criteria);
  252.         switch($this->type) {
  253.             case TargetChoiceUtil::MODELPLAN:
  254.                 return $this->handleModelPlanRequest($filter$criteria);
  255.             case TargetChoiceUtil::HOTEL:
  256.                 return $this->handleHotelRequest($filter$criteria);
  257.             case TargetChoiceUtil::WORKSPACE:
  258.                 return $this->handleWorkSpaceRequest($filter$criteria);
  259.             case TargetChoiceUtil::ACTIVITY:
  260.             case TargetChoiceUtil::MOBILITY:
  261.                 return $this->handleActivityRequest($filter$criteria);
  262.         }
  263.         throw new \InvalidArgumentException('type unset. call setType() before.');
  264.     }
  265.     private function handleAreaRequest(array $filter, array $criteria): array
  266.     {
  267.         if(isset($criteria['area'])) {
  268.             $filter['Area'] = $this->handleRequestSingle($filter['Area'], $criteria['area']);
  269.         }
  270.         return $filter;
  271.     }
  272.     private function handleModelPlanRequest(array $filter, array $criteria): array
  273.     {
  274.         if(isset($criteria['target']) && is_array($criteria['target'])) {
  275.             $filter['Target'] = $this->handleRequestMultiple($filter['Target'], $criteria['target']);
  276.         }
  277.         if(isset($criteria['equipment']) && is_array($criteria['equipment'])) {
  278.             $filter['Equipment'] = $this->handleRequestMultiple($filter['Equipment'], $criteria['equipment']);
  279.         }
  280.         if(isset($criteria['service']) && is_array($criteria['service'])) {
  281.             $filter['Service'] = $this->handleRequestMultiple($filter['Service'], $criteria['service']);
  282.         }
  283.         if(isset($criteria['tag']) && is_array($criteria['tag'])) {
  284.             $filter['Tag'] = $this->handleRequestMultiple($filter['Tag'], $criteria['tag']);
  285.         }
  286.         return $filter;
  287.     }
  288.     private function handleHotelRequest(array $filter, array $criteria): array
  289.     {
  290.         if(isset($criteria['target']) && is_array($criteria['target'])) {
  291.             $filter['Target'] = $this->handleRequestMultiple($filter['Target'], $criteria['target']);
  292.         }
  293.         if(isset($criteria['equipment']) && is_array($criteria['equipment'])) {
  294.             $filter['Equipment'] = $this->handleRequestMultiple($filter['Equipment'], $criteria['equipment']);
  295.         }
  296.         if(isset($criteria['service']) && is_array($criteria['service'])) {
  297.             $filter['Service'] = $this->handleRequestMultiple($filter['Service'], $criteria['service']);
  298.         }
  299.         return $filter;
  300.     }
  301.     private function handleWorkSpaceRequest(array $filter, array $criteria): array
  302.     {
  303.         if(isset($criteria['equipment']) && is_array($criteria['equipment'])) {
  304.             $filter['Equipment'] = $this->handleRequestMultiple($filter['Equipment'], $criteria['equipment']);
  305.         }
  306.         if(isset($criteria['service']) && is_array($criteria['service'])) {
  307.             $filter['Service'] = $this->handleRequestMultiple($filter['Service'], $criteria['service']);
  308.         }
  309.         return $filter;
  310.     }
  311.     private function handleActivityRequest(array $filter, array $criteria): array
  312.     {
  313.         if(isset($criteria['service']) && is_array($criteria['service'])) {
  314.             $filter['Service'] = $this->handleRequestMultiple($filter['Service'], $criteria['service']);
  315.         }
  316.         if(isset($criteria['target']) && is_array($criteria['target'])) {
  317.             $filter['Target'] = $this->handleRequestMultiple($filter['Target'], $criteria['target']);
  318.         }
  319.         if(isset($criteria['tag']) && is_array($criteria['tag'])) {
  320.             $filter['Tag'] = $this->handleRequestMultiple($filter['Tag'], $criteria['tag']);
  321.         }
  322.         if(isset($criteria['category'])) {
  323.             $filter['Category'] = $this->handleRequestSingle($filter['Category'], $criteria['category']);
  324.         }
  325.         return $filter;
  326.     }
  327.     private function handleRequestSingle(array $filterSingle$value): array
  328.     {
  329.         $value intval($value);
  330.         if(!$value) return $filterSingle;
  331.         foreach($filterSingle['choices'] as $groupName => $choices) {
  332.             if(isset($filterSingle['choices'][$groupName][$value])) {
  333.                 $filterSingle['choices'][$groupName][$value]['choice'] = true;
  334.                 $filterSingle['choice'] = $value;
  335.             }
  336.         }
  337.         return $filterSingle;
  338.     }
  339.     private function handleRequestMultiple(array $filterItem, array $choiceIds): array
  340.     {
  341.         if(!count($choiceIds)) return $filterItem;
  342.         foreach($choiceIds as $choiceId) {
  343.             foreach($filterItem['choices'] as $groupName => $choices) {
  344.                 if(isset($choices[$choiceId])) {
  345.                     $filterItem['choices'][$groupName][$choiceId]['choice'] = true;
  346.                     if(null === $filterItem['choice']) {
  347.                         $filterItem['choice'] = [];
  348.                     }
  349.                     $filterItem['choice'][] = $choiceId;
  350.                 }
  351.             }
  352.         }
  353.         return $filterItem;
  354.     }
  355.     /**
  356.      * 現在の区分に基づくQueryBuilderを構築
  357.      * @param string $alias
  358.      * @return QueryBuilder
  359.      */
  360.     public function getQueryBuilderForList(string $alias "a"): QueryBuilder
  361.     {
  362.         $qb $this->entryRepository->getListQuery([]);
  363.         if($this->type !== TargetChoiceUtil::ACTIVITY) {
  364.             $qb
  365.                 ->andWhere($qb->expr()->eq("e.category"":category"))
  366.                 ->setParameter("category"$this->type);
  367.         }
  368.         $this->entryRepository->setDefaultOrder($qb);
  369.         $this->entryRepository->addPublishWhere($qb);
  370.         switch($this->type) {
  371.             case TargetChoiceUtil::MODELPLAN:
  372.                 $qb
  373.                     ->leftJoin(ModelPlan::class, $alias"with""e.id = ".$alias.".Entry");
  374.                 break;
  375.             case TargetChoiceUtil::HOTEL:
  376.                 $qb
  377.                     ->leftJoin(Hotel::class, $alias"with""e.id = ".$alias.".Entry");
  378.                 break;
  379.             case TargetChoiceUtil::WORKSPACE:
  380.                 $qb
  381.                     ->innerJoin(Workspace::class, $alias"with""e.id = ".$alias.".Entry");
  382.                 break;
  383.             case TargetChoiceUtil::ACTIVITY:
  384.             case TargetChoiceUtil::MOBILITY:
  385.                 $qb
  386.                     ->leftJoin(Actibity::class, $alias"with""e.id = ".$alias".Entry");
  387.                 break;
  388.         }
  389.         return $qb;
  390.     }
  391.     /**
  392.      * getFilter()で取得してhandleRequest()で設定した選択肢データに基づいて
  393.      * DQLの検索条件を設定していく
  394.      *
  395.      * @param QueryBuilder $qb
  396.      * @param array $filter
  397.      * @param string $alias
  398.      * @param string $entryAlias
  399.      * @return QueryBuilder
  400.      */
  401.     public function addDqlWhere(QueryBuilder $qb, array $filterstring $alias "a"string $entryAlias "e"): QueryBuilder
  402.     {
  403.         if(isset($filter['Area'])) {
  404.             if($filter['Area']['choice']) {
  405.                 $qb
  406.                     ->andWhere($qb->expr()->eq("area.area_group"":Area"))
  407.                     ->setParameter("Area"$filter['Area']['choice'])
  408.                 ;
  409.             }
  410.         }
  411.         switch(true) {
  412.             case TargetChoiceUtil::inModelPlan($this->type):
  413.             case TargetChoiceUtil::inHotel($this->type):
  414.             case TargetChoiceUtil::inWorkspace($this->type):
  415.             $qb
  416.                 ->andWhere($qb->expr()->eq($entryAlias.".category"":Category"))
  417.                 ->setParameter("Category"$this->type)
  418.                 ;
  419.             break;
  420.             case TargetChoiceUtil::inActivity($this->type):
  421.                 if(isset($filter['Category']) && $filter['Category']['choice']) {
  422.                     $qb
  423.                         ->andWhere($qb->expr()->eq($entryAlias.".category"":Category"))
  424.                         ->setParameter("Category"$filter['Category']['choice'])
  425.                     ;
  426.                 } else {
  427.                     $qb
  428.                         ->andWhere($qb->expr()->in($entryAlias.".category"":Category"))
  429.                         ->setParameter("Category", [TargetChoiceUtil::ACTIVITYTargetChoiceUtil::MOBILITY])
  430.                         ;
  431.                 }
  432.             break;
  433.         }
  434.         $this
  435.             ->addDqlWhereMultiple($qb$filter"Target"$alias.".Target")
  436.             ->addDqlWhereMultiple($qb$filter"Equipment"$alias.".Equipment")
  437.             ->addDqlWhereMultiple($qb$filter"Service"$alias".Service")
  438.             ->addDqlWhereMultiple($qb$filter"Tag"$alias".Tag")
  439.         ;
  440.         return $qb;
  441.     }
  442.     private function addDqlWhereSingle(QueryBuilder $qb, array $filterstring $namestring $columnName): self
  443.     {
  444.         if(isset($filter[$name]) && $filter[$name]['choice']) {
  445.             $qb
  446.                 ->andWhere(":"$name" MEMBER OF "$columnName)
  447.                 ->setParameter($name$filter[$name]['choice']);
  448.         }
  449.         return $this;
  450.     }
  451.     private function addDqlWhereMultiple(QueryBuilder $qb, array $filterstring $namestring $columnName): self
  452.     {
  453.         if(isset($filter[$name])) {
  454.             $choice $filter[$name]['choice'];
  455.             if(is_array($choice) && count($choice)) {
  456.                 $qb
  457.                     ->andWhere(":".$name" MEMBER OF "$columnName)
  458.                     ->setParameter($name$choice);
  459.             }
  460.         }
  461.         return $this;
  462.     }
  463.     /**
  464.      * ページネーションを適用させる
  465.      * @param QueryBuilder $queryBuilder
  466.      * @param array $criteria
  467.      * @return PaginationUtil
  468.      */
  469.     public function handleList(QueryBuilder $queryBuilder, array $criteria): PaginationUtil
  470.     {
  471.         if(!isset($criteria['page'])) {
  472.             $criteria['page'] = 1;
  473.         }
  474.         if(!isset($criteria['limit'])) {
  475.             $criteria['limit'] = 10;
  476.         }
  477.         return new PaginationUtil($queryBuilder$criteria['page'], $criteria['limit']);
  478.     }
  479.     /**
  480.      * 選択肢設定からURLクエリー用の配列を作る
  481.      * @param array $filter
  482.      * @return array
  483.      */
  484.     public function createQueryFromFilter(array $filter): array
  485.     {
  486.         $queries = [];
  487.         if(isset($filter['Area']) && $filter['Area']['choice']) {
  488.             $queries['area'] = $filter['Area']['choice'];
  489.         }
  490.         if($target $this->createMultiQuery($filter"Target")) {
  491.             $queries['target'] = $target;
  492.         }
  493.         if($equipment $this->createMultiQuery($filter"Equipment")) {
  494.             $queries['equipment'] = $equipment;
  495.         }
  496.         if($service $this->createMultiQuery($filter"Service")) {
  497.             $queries['service'] = $service;
  498.         }
  499.         if($tag $this->createMultiQuery($filter"Tag")) {
  500.             $queries['tag'] = $tag;
  501.         }
  502.         if(isset($filter['Category']) && $filter['Category']['choice']) {
  503.             $queries['category'] = $filter['Category']['choice'];
  504.         }
  505.         return $queries;
  506.     }
  507.     private function createMultiQuery(array $filterstring $name): ?array
  508.     {
  509.         if(isset($filter[$name]) && is_array($filter[$name]['choice']) && count($filter[$name]['choice'])) {
  510.             return $filter[$name]['choice'];
  511.         }
  512.         return null;
  513.     }
  514.     /**
  515.      * 記事1件取得
  516.      * @param int $id
  517.      * @return Entry|null
  518.      * @throws \Doctrine\ORM\NonUniqueResultException
  519.      */
  520.     public function getOneEntry(int $id): ?Entry
  521.     {
  522.         $qb $this->entryRepository->createQueryBuilder('e');
  523.         $this->entryRepository->addPublishWhere($qb);
  524.         $this->entryRepository->joinOwner($qb);
  525.         $qb
  526.             ->andWhere($qb->expr()->eq('e.id'':id'))
  527.             ->setParameter('id'$id)
  528.             ;
  529.         $this->addCategoryQuery($qb);
  530.         return $qb->getQuery()->getOneOrNullResult();
  531.     }
  532.     /**
  533.      * 同じカテゴリ・同じエリアの他の施設を返す
  534.      * @param Entry $entry
  535.      * @param int $maxResult
  536.      * @return array
  537.      */
  538.     public function getRelatedEntry(Entry $entryint $maxResult 3): array
  539.     {
  540.         $qb $this->entryRepository->createQueryBuilder('e');
  541.         $this->entryRepository->addPublishWhere($qb);
  542.         $this->entryRepository->joinOwner($qb);
  543.         $this->addCategoryQuery($qb)
  544.             ->leftJoin(Area::class, "area""with""e.Area = area.id")
  545.             ->andWhere($qb->expr()->eq('area.area_group'':area'))
  546.             ->setParameter("area"$entry->getArea()->getAreaGroup())
  547.             ->andWhere($qb->expr()->neq('e.id'':id'))
  548.             ->setParameter('id'$entry->getId())
  549.             ->setMaxResults($maxResult)
  550.             ->orderBy('rand()')
  551.             ;
  552.         return $qb->getQuery()->getResult();
  553.     }
  554.     /**
  555.      * おすすめ一覧
  556.      * @param int $limit
  557.      * @return array
  558.      */
  559.     public function getRecommends(int $limit 9): array
  560.     {
  561.         $qb $this->entryRepository->createQueryBuilder('e');
  562.         $qb
  563.             ->leftJoin(ModelPlan::class, "m""with""e.id = m.Entry")
  564.             ->andWhere("e.category = 1")
  565.             ->setMaxResults($limit)
  566.             ->orderBy('m.is_recommend''DESC')
  567.             ->addOrderBy('rand()')
  568.             ->addOrderBy('e.id''DESC')
  569.             ;
  570.         $this->entryRepository->addPublishWhere($qb);
  571.         $this->entryRepository->joinOwner($qb);
  572.         return $qb->getQuery()->getResult();
  573.     }
  574.     /**
  575.      * 現在指定のカテゴリをQBに追加
  576.      * @param QueryBuilder $qb
  577.      * @return QueryBuilder
  578.      */
  579.     private function addCategoryQuery(QueryBuilder $qb): QueryBuilder {
  580.         switch(true) {
  581.             case TargetChoiceUtil::inModelPlan($this->type):
  582.             case TargetChoiceUtil::inHotel($this->type):
  583.             case TargetChoiceUtil::inWorkspace($this->type):
  584.                 $qb
  585.                     ->andWhere($qb->expr()->eq('e.category'':category'))
  586.                     ->setParameter('category'$this->type)
  587.                 ;
  588.                 break;
  589.             case TargetChoiceUtil::inActivity($this->type):
  590.                 $qb
  591.                     ->andWhere($qb->expr()->in('e.category'':category'))
  592.                     ->setParameter('category', [TargetChoiceUtil::ACTIVITYTargetChoiceUtil::MOBILITY])
  593.                 ;
  594.                 break;
  595.         }
  596.         return $qb;
  597.     }
  598. }