feat: add typed dto for cms data
This commit is contained in:
@@ -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', [
|
||||
|
||||
Reference in New Issue
Block a user