src/Controller/V1/LocationController.php line 36

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Controller\V1;
  4. use App\Repository\LocationRepository;
  5. use FOS\RestBundle\Controller\Annotations as Rest;
  6. use Nelmio\ApiDocBundle\Annotation\Model;
  7. use Swagger\Annotations as SWG;
  8. use Symfony\Component\Routing\Annotation\Route;
  9. /**
  10.  * @Route("/locations")
  11.  * @SWG\Tag(name="Cinema_v1")
  12.  */
  13. class LocationController
  14. {
  15.     /** @var LocationRepository */
  16.     protected $locationRepository;
  17.     public function __construct(LocationRepository $locationRepository)
  18.     {
  19.         $this->locationRepository $locationRepository;
  20.     }
  21.     /**
  22.      * @Route("", methods={"GET"})
  23.      * @Rest\View()
  24.      * @SWG\Response(
  25.      *     response="200",
  26.      *     description="Success",
  27.      *     @SWG\Schema(type="array", items=@SWG\Items(ref=@Model(type=\App\Entity\Local\Location::class)))
  28.      * )
  29.      * @return array
  30.      */
  31.     public function indexAction()
  32.     {
  33.         return $this->locationRepository->findAll();
  34.     }
  35. }