feat: re-implement contact form submissions api endpoint for website

This commit is contained in:
Björn Fromme committed 2025-12-10 09:29:19 +01:00
1 parent e27b5da3c8
commit 2b8046b416
11 files changed
+182 -10

No files matched your search

+5 -4
View File
@@ -3,6 +3,7 @@
namespace App\Controller\Api;
use App\BusProNet\XmlLoader\HotelLoader;
use App\Exception\HotelNotFoundException;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
@@ -28,12 +29,12 @@ class HotelController extends AbstractController
#[Route('/hotels/{id}', name: 'api_hotels_single')]
public function single(int $id): JsonResponse
{
$hotel = $this->xmlLoader->loadById($id);
try {
$hotel = $this->xmlLoader->loadById($id);
if (null === $hotel) {
return $this->json($hotel, Response::HTTP_OK, [], ['groups' => 'api:single']);
} catch (HotelNotFoundException $e) {
return new JsonResponse(['message' => 'Not found'], Response::HTTP_NOT_FOUND);
}
return $this->json($hotel, Response::HTTP_OK, [], ['groups' => 'api:single']);
}
}