src/MDS/ApiBundle/Controller/ApiHtEscandalloController.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\MDS\ApiBundle\Controller;
  3. use App\Entity\Escandallo;
  4. use App\Entity\FamilyEscandallo;
  5. use App\Repository\FamilyRepository;
  6. use Doctrine\ORM\EntityManagerInterface;
  7. use FOS\RestBundle\Controller\AbstractFOSRestController;
  8. use FOS\RestBundle\Controller\Annotations as Rest;
  9. use Symfony\Component\HttpFoundation\Response;
  10. final class ApiHtEscandalloController extends AbstractFOSRestController
  11. {
  12.     /**
  13.      * Devuelve todos los escandallos de una familia
  14.      * 
  15.      * @Rest\Get("/api/ht/escandallo/family/{id}")
  16.      */
  17.     function getEscandallosByFamily(FamilyEscandallo $familyEscandalloFamilyRepository $familyRepositoryEntityManagerInterface $em) : Response {
  18. //        $escandallos = $familyEscandallo->getEscandallo();
  19.         $escandallos $em->getRepository(Escandallo::class)->findAll();;
  20.         $html '';
  21.         foreach ($escandallos as $escandallo) {
  22.             $html .= "<option value=\"{$escandallo->getId()}\">{$escandallo->getNombre()}</option>";
  23.         }
  24.         return new Response($htmlResponse::HTTP_OK,);
  25.     }
  26. }