feat: add typed dto for cms data

This commit is contained in:
Björn Fromme
2026-04-12 18:17:54 +02:00
parent 6ab34fa87c
commit 16cab4b768
13 changed files with 78 additions and 34 deletions
+7 -9
View File
@@ -12,6 +12,7 @@ use App\Form\Model\BookingDto;
use App\Form\Model\BookingSummaryDto;
use App\Form\Model\BookingSummaryPricingDto;
use App\Form\Model\BookingSummaryVoucherDto;
use App\Model\BookingSummaryCmsHotelDto;
use Psr\Log\LoggerInterface;
use Symfony\Contracts\Cache\CacheInterface;
use Symfony\Contracts\Cache\ItemInterface;
@@ -153,7 +154,7 @@ class BookingSummaryDataService
* Data is cached for 1 hour. This method can be called early in the booking
* flow to warm the cache.
*/
public function getCmsDataForProduct(?string $productCode, ?string $hotelCode): ?array
public function getCmsDataForProduct(?string $productCode, ?string $hotelCode): ?BookingSummaryCmsHotelDto
{
if (null === $hotelCode) {
return null;
@@ -171,14 +172,11 @@ class BookingSummaryDataService
// Fetch CMS images (nice to have)
$images = $this->cmsDataService->getProductImages($productCode, $hotelCode);
// Return combined data structure compatible with templates
return [
'hotel' => [
'name' => $baseHotel?->name,
'address' => $this->formatHotelAddress($baseHotel),
'images' => $images,
],
];
return new BookingSummaryCmsHotelDto(
name: $baseHotel?->name,
address: $this->formatHotelAddress($baseHotel),
images: $images,
);
});
} catch (\Throwable $e) {
$this->logger->error('Failed to fetch hotel display data', [