'json'])] public function currentLocation(mixed $_format): JsonResponse { if (!$this->isGranted('ROLE_USER')) { throw new AccessDeniedHttpException(); } return $this->json( $this->security->getUser()->getCurrentLocation(), JsonResponse::HTTP_OK, [], ['groups' => ['read']] ); } #[Route(path: '/api/1.0/main/whoami.{_format}', name: 'chill_main_user_whoami', requirements: ['_format' => 'json'])] public function whoami(mixed $_format): JsonResponse { return $this->json( $this->getUser(), JsonResponse::HTTP_OK, [], ['groups' => ['read']] ); } /** * @param QueryBuilder $query */ protected function customizeQuery(string $action, Request $request, $query): void { if ('_index' === $action) { $query->andWhere($query->expr()->eq('e.enabled', "'TRUE'")); } } protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator, $_format) { return $query->orderBy('e.label', 'ASC'); } }