specialistViewRepository ->createFilteredQueryBuilder($filters) ->getQuery() ; $paginatedSpecialists = $this->paginator->paginate($query, $page, $limit); foreach ($paginatedSpecialists as $key => $specialist) { $specialist->addSpecialistMoreService( new SpecialistMoreService( $this->locationViewRepository, $this->reviewRepository, $this->priceListRepository, $filters['onlineMode'] ?? false ) ); } return $paginatedSpecialists; } public function list(array $filters = []): array { $specialists = $this->specialistViewRepository ->createFilteredQueryBuilder($filters) ->getQuery() ->getResult() ; foreach ($specialists as $key => $specialist) { $specialist->addSpecialistMoreService( new SpecialistMoreService( $this->locationViewRepository, $this->reviewRepository, $this->priceListRepository, $filters['onlineMode'] ?? false ) ); } return $specialists; } public function show(array $filters = []): ?SpecialistView { $specialist = $this->specialistViewRepository ->createFilteredQueryBuilder($filters) ->setMaxResults(1) ->getQuery() ->getOneOrNullResult(); ; if ($specialist) { $specialist->addSpecialistMoreService( new SpecialistMoreService( $this->locationViewRepository, $this->reviewRepository, $this->priceListRepository, $filters['onlineMode'] ?? false ) ); } return $specialist; } }