QCharts/ApiBundle/Controller/FavoriteController.php
public function getFavoritesAction()
    {
        $roles = $this->getParameter("qcharts.user_roles");
        $authService = $this->get("security.authorization_checker");
        $favService = $this->get("qcharts.core.favorite_service");

        $options = [];

        try
        {
            ApiController::checkCredentials($authService, $roles, "user");

            $user = $this->getUser();
            $favorites = $favService->getFavourites($user);
            $options = [
                "status" => 200,
                "textStatus" => "favorites returned",
                "favorites" => $favorites,
                "count" => count($favorites)
            ];
        }
        catch (InvalidCredentialsException $e)
        {
            $options = [
                "status" => $e->getCode(),
                "textStatus" => $e->getMessage()
            ];
        }
        finally
        {
            return new JsonResponse($options);
        }

    }
public function getFavoritesAction()
    {
        $roles = $this->getParameter("qcharts.user_roles");
        $authService = $this->get("security.authorization_checker");
        $favService = $this->get("qcharts.core.favorite_service");

        $options = [];

        try
        {
            ApiController::checkCredentials($authService, $roles, "user");

            $user = $this->getUser();
            $favorites = $favService->getFavourites($user);
            $options = [
                "status" => 200,
                "textStatus" => "favorites returned",
                "favorites" => $favorites,
                "count" => count($favorites)
            ];
        }
        catch (InvalidCredentialsException $e)
        {
            $options = [
                "status" => $e->getCode(),
                "textStatus" => $e->getMessage()
            ];
        }
        finally
        {
            return new JsonResponse($options);
        }

    }
ApiDoc(
description="Returns the favorite Query from the current user",
statusCodes = {
200 = "Returns the favorites from the current user"
}
)
@return JsonResponse
@throws \QCharts\ApiBundle\Exception\InvalidCredentialsException