feat: refactoring and cleanup
This commit is contained in:
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace App\Service;
|
||||
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Model\BookingSummaryDto;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Contracts\Cache\CacheInterface;
|
||||
use Symfony\Contracts\Cache\ItemInterface;
|
||||
@@ -27,18 +28,8 @@ class BookingSummaryDataService
|
||||
|
||||
/**
|
||||
* Get complete summary data for booking sidebar.
|
||||
*
|
||||
* @return array{
|
||||
* selectedRooms: array,
|
||||
* participantCount: int,
|
||||
* totalPrice: string,
|
||||
* groupedSelectedRooms: array,
|
||||
* assignmentCounts: array,
|
||||
* pricingData: array,
|
||||
* cmsData: array|null
|
||||
* }
|
||||
*/
|
||||
public function getSummaryData(BookingDto $bookingDto): array
|
||||
public function getSummaryData(BookingDto $bookingDto): BookingSummaryDto
|
||||
{
|
||||
// Get selected rooms (for Step1 controller compatibility)
|
||||
$selectedRooms = $bookingDto->getSelectedRooms();
|
||||
@@ -57,7 +48,7 @@ class BookingSummaryDataService
|
||||
}
|
||||
}
|
||||
|
||||
// Group selected rooms with counts
|
||||
// Group selected rooms with counts (for display)
|
||||
$groupedSelectedRooms = [];
|
||||
foreach ($roomCounts as $roomId => $count) {
|
||||
$room = $bookingDto->travel->getRoomById($roomId);
|
||||
@@ -78,15 +69,15 @@ class BookingSummaryDataService
|
||||
// Calculate participant count from room capacity (source of truth)
|
||||
$participantCount = $this->calculateParticipantCountFromRooms($bookingDto);
|
||||
|
||||
return [
|
||||
'selectedRooms' => $selectedRooms,
|
||||
'participantCount' => $participantCount,
|
||||
'totalPrice' => number_format($totalPrice, 2, ',', '.').' €',
|
||||
'groupedSelectedRooms' => $groupedSelectedRooms,
|
||||
'assignmentCounts' => $roomCounts,
|
||||
'pricingData' => $pricingData,
|
||||
'cmsData' => $cmsData,
|
||||
];
|
||||
return new BookingSummaryDto(
|
||||
selectedRooms: $selectedRooms,
|
||||
participantCount: $participantCount,
|
||||
totalPrice: number_format($totalPrice, 2, ',', '.').' €',
|
||||
groupedSelectedRooms: $groupedSelectedRooms,
|
||||
assignmentCounts: $roomCounts,
|
||||
pricingData: $pricingData,
|
||||
cmsData: $cmsData,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user