<?php
namespace App\Controller\Api;
use App\Entity\NutrientsRecommendedQuantity;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class NutrientsController extends AbstractController
{
use \App\Controller\Response;
#[Route('/api/nutrients/recommendations',
name: 'api_nutrients_recommendations', methods: ["GET"])]
public function recommendations(EntityManagerInterface $em): Response
{
$user = $this->getUser();
$nutrients = $em->getRepository(NutrientsRecommendedQuantity::class)->findAll();
return $this->json([
'status' => 'ok',
'data' => $nutrients,
], 200, [], ['groups' => ["nutrient:read"]]);
}
}