<?php
namespace App\MDS\ApiBundle\Controller;
use App\Entity\FamilyEscandallo;
use App\Repository\FamilyRepository;
use FOS\RestBundle\Controller\AbstractFOSRestController;
use FOS\RestBundle\Controller\Annotations as Rest;
use Symfony\Component\HttpFoundation\Response;
final class ApiHtEscandalloController extends AbstractFOSRestController
{
/**
* Devuelve todos los escandallos de una familia
*
* @Rest\Get("/api/ht/escandallo/family/{id}")
*/
function getEscandallosByFamily(FamilyEscandallo $familyEscandallo, FamilyRepository $familyRepository) : Response {
$escandallos = $familyEscandallo->getEscandallo();
$html = '';
foreach ($escandallos as $escandallo) {
$html .= "<option value=\"{$escandallo->getId()}\">{$escandallo->getNombre()}</option>";
}
return new Response($html, Response::HTTP_OK,);
}
}