Files
caprigis-api/src/Controller/GeoImageController.php
2025-06-19 16:21:16 +02:00

37 lines
1.0 KiB
PHP

<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Attribute\Route;
use App\Entity\GeoImage;
use Doctrine\ORM\EntityManagerInterface;
class GeoImageController extends AbstractController
{
#[Route('/geoimages', name: 'app_geo_images')]
public function index(EntityManagerInterface $em): JsonResponse
{
$repo = $em->getRepository(GeoImage::class);
$geoImages = $repo->findAllWithGeometry();
return $this->json($geoImages);
}
#[Route('/geoimages/menu', name: 'app_geo_image_menu')]
public function menu(EntityManagerInterface $em): JsonResponse
{
$repo = $em->getRepository(GeoImage::class);
$geoImages = $repo->findLabelsAndIds();
return $this->json($geoImages);
}
#[Route('/geoimages/{id}', name: 'app_geo_image_record')]
public function record(GeoImage $geoImage): JsonResponse
{
return $this->json($geoImage);
}
}