json( $this->getUser()->getCurrentLocation(), JsonResponse::HTTP_OK, [], ['groups' => ['read']] ); } /** * @Route( * "/api/1.0/main/whoami.{_format}", * name="chill_main_user_whoami", * requirements={ * "_format": "json" * } * ) * * @param mixed $_format */ public function whoami($_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'")); } } /** * @param mixed $query * @param mixed $_format */ protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator, $_format) { return $query->orderBy('e.label', 'ASC'); } }