feat: replace *Service suffix with role-based class names
This commit is contained in:
@@ -331,7 +331,7 @@ class BookingDto
|
||||
*
|
||||
* Replaces the full Travel object with just its integer ID. The Booking's
|
||||
* travelData reference is also removed since it points to the same object.
|
||||
* BookingService::hydrate() restores the Travel from cache after session read.
|
||||
* BookingConfigurator::hydrate() restores the Travel from cache after session read.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
@@ -356,7 +356,7 @@ class BookingDto
|
||||
/**
|
||||
* Restores the DTO from session data with a minimal Travel placeholder.
|
||||
*
|
||||
* Creates a Travel object containing only the ID. BookingService::hydrate()
|
||||
* Creates a Travel object containing only the ID. BookingConfigurator::hydrate()
|
||||
* replaces this with the full Travel from cache on every session read.
|
||||
*
|
||||
* @param array<string, mixed> $data
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace App\Form\Service\Condition;
|
||||
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Service\Contract\FieldConditionInterface;
|
||||
use App\Service\ParticipantEligibilityService;
|
||||
use App\Service\ParticipantEligibilityChecker;
|
||||
|
||||
/**
|
||||
* Condition that evaluates whether a participant is eligible for booking.
|
||||
@@ -26,7 +26,7 @@ use App\Service\ParticipantEligibilityService;
|
||||
class BookingEligibilityCondition implements FieldConditionInterface
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ParticipantEligibilityService $participantEligibilityService,
|
||||
private readonly ParticipantEligibilityChecker $participantEligibilityService,
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ use App\Form\Service\Condition\ServiceSubTypeCondition;
|
||||
use App\Form\Service\Condition\SingleRoomTypeCondition;
|
||||
use App\Form\Service\Condition\SkiPassSelectionCondition;
|
||||
use App\Form\Service\Condition\TravelStartCutoffReachedCondition;
|
||||
use App\Service\ParticipantEligibilityService;
|
||||
use App\Service\ParticipantEligibilityChecker;
|
||||
|
||||
/**
|
||||
* Field state provider for the booking create workflow.
|
||||
@@ -44,7 +44,7 @@ use App\Service\ParticipantEligibilityService;
|
||||
class CreateFieldStateProvider extends AbstractFieldStateProvider
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ParticipantEligibilityService $participantEligibilityService,
|
||||
private readonly ParticipantEligibilityChecker $participantEligibilityService,
|
||||
) {
|
||||
parent::__construct();
|
||||
}
|
||||
@@ -317,7 +317,7 @@ class CreateFieldStateProvider extends AbstractFieldStateProvider
|
||||
|
||||
// Room assignment field:
|
||||
// - Hidden until date of birth is provided (age determines room eligibility, e.g., Baby rooms)
|
||||
// - Rendered as static text when only one room type is selected (auto-assigned by RoomAssignmentService)
|
||||
// - Rendered as static text when only one room type is selected (auto-assigned by RoomAssigner)
|
||||
$this->fieldStateConditions['assignedRoomId'] = [
|
||||
'hidden' => CompositeCondition::not($dateOfBirthProvidedCondition),
|
||||
'static_text' => new SingleRoomTypeCondition(),
|
||||
|
||||
@@ -14,8 +14,8 @@ use App\BusProNet\Utility\DirectionMapper;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Model\RoomSelectionDto;
|
||||
use App\Form\Service\Abstract\AbstractFieldOptionsProvider;
|
||||
use App\Service\BookingPriceCalculatorService;
|
||||
use App\Service\InsuranceService;
|
||||
use App\Service\BookingPriceCalculator;
|
||||
use App\Service\InsuranceManager;
|
||||
use App\Service\ServiceLabelFormatter;
|
||||
use App\Service\ServiceAvailabilityCalculator;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
@@ -41,8 +41,8 @@ class ParticipantFieldOptionsProvider extends AbstractFieldOptionsProvider
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ServiceAvailabilityCalculator $serviceAvailabilityCalculator,
|
||||
private readonly InsuranceService $insuranceService,
|
||||
private readonly BookingPriceCalculatorService $priceCalculatorService,
|
||||
private readonly InsuranceManager $insuranceService,
|
||||
private readonly BookingPriceCalculator $priceCalculatorService,
|
||||
private readonly ServiceLabelFormatter $serviceLabelFormatter,
|
||||
private readonly TranslatorInterface $translator,
|
||||
) {
|
||||
@@ -1112,14 +1112,14 @@ class ParticipantFieldOptionsProvider extends AbstractFieldOptionsProvider
|
||||
/**
|
||||
* Gets the rental insurance description for help text.
|
||||
*/
|
||||
private function getRentalInsuranceDescription(array $rentalInsuranceServices): ?string
|
||||
private function getRentalInsuranceDescription(array $rentalInsuranceManagers): ?string
|
||||
{
|
||||
if (empty($rentalInsuranceServices)) {
|
||||
if (empty($rentalInsuranceManagers)) {
|
||||
return null;
|
||||
}
|
||||
$rentalInsuranceService = reset($rentalInsuranceServices); // Get the first (and only) rental insurance service
|
||||
$rentalInsuranceManager = reset($rentalInsuranceManagers); // Get the first (and only) rental insurance service
|
||||
|
||||
return $rentalInsuranceService->description;
|
||||
return $rentalInsuranceManager->description;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,8 +7,8 @@ namespace App\Form\Service;
|
||||
use App\BusProNet\Model\Insurance;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Service\Abstract\AbstractParticipantFieldHandler;
|
||||
use App\Service\BookingPriceCalculatorService;
|
||||
use App\Service\InsuranceService;
|
||||
use App\Service\BookingPriceCalculator;
|
||||
use App\Service\InsuranceManager;
|
||||
|
||||
/**
|
||||
* Handles processing of the insurance field for booking participants.
|
||||
@@ -35,8 +35,8 @@ use App\Service\InsuranceService;
|
||||
class ParticipantInsuranceFieldHandler extends AbstractParticipantFieldHandler
|
||||
{
|
||||
public function __construct(
|
||||
private readonly InsuranceService $insuranceService,
|
||||
private readonly BookingPriceCalculatorService $priceCalculatorService,
|
||||
private readonly InsuranceManager $insuranceService,
|
||||
private readonly BookingPriceCalculator $priceCalculatorService,
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ namespace App\Form\Service;
|
||||
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Service\Abstract\AbstractParticipantFieldHandler;
|
||||
use App\Service\BookingPriceCalculatorService;
|
||||
use App\Service\VoucherValidationService;
|
||||
use App\Service\BookingPriceCalculator;
|
||||
use App\Service\VoucherValidator;
|
||||
|
||||
/**
|
||||
* Handles promotional voucher code field processing.
|
||||
@@ -22,8 +22,8 @@ use App\Service\VoucherValidationService;
|
||||
class ParticipantPromoVoucherFieldHandler extends AbstractParticipantFieldHandler
|
||||
{
|
||||
public function __construct(
|
||||
private readonly VoucherValidationService $voucherValidationService,
|
||||
private readonly BookingPriceCalculatorService $priceCalculatorService,
|
||||
private readonly VoucherValidator $voucherValidationService,
|
||||
private readonly BookingPriceCalculator $priceCalculatorService,
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace App\Form\Service;
|
||||
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Service\Abstract\AbstractParticipantFieldHandler;
|
||||
use App\Service\VoucherValidationService;
|
||||
use App\Service\VoucherValidator;
|
||||
|
||||
/**
|
||||
* Handles purchase voucher code field processing.
|
||||
@@ -20,7 +20,7 @@ use App\Service\VoucherValidationService;
|
||||
class ParticipantPurchaseVoucherFieldHandler extends AbstractParticipantFieldHandler
|
||||
{
|
||||
public function __construct(
|
||||
private readonly VoucherValidationService $voucherValidationService,
|
||||
private readonly VoucherValidator $voucherValidationService,
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ class ParticipantRentalInsuranceFieldHandler extends AbstractParticipantFieldHan
|
||||
|
||||
// Store service object based on checkbox state for pricing calculations
|
||||
if (true === $isRentalInsuranceSelected) {
|
||||
$participant->rentalInsurance = $this->findRentalInsuranceService($bookingDto, $participantIndex);
|
||||
$participant->rentalInsurance = $this->findRentalInsuranceManager($bookingDto, $participantIndex);
|
||||
} else {
|
||||
$participant->rentalInsurance = null;
|
||||
}
|
||||
@@ -124,20 +124,20 @@ class ParticipantRentalInsuranceFieldHandler extends AbstractParticipantFieldHan
|
||||
*
|
||||
* @return Service|null The rental insurance service object, or null if not found
|
||||
*/
|
||||
private function findRentalInsuranceService(BookingDto $bookingDto, int $participantIndex): ?Service
|
||||
private function findRentalInsuranceManager(BookingDto $bookingDto, int $participantIndex): ?Service
|
||||
{
|
||||
// Get available rental insurance services (includes booked insurance in edit mode)
|
||||
$rentalInsuranceServices = $this->getAvailableServicesWithBooked(
|
||||
$rentalInsuranceManagers = $this->getAvailableServicesWithBooked(
|
||||
$bookingDto,
|
||||
$participantIndex,
|
||||
Constants::TOKEN_RENTAL_INSURANCE,
|
||||
true
|
||||
);
|
||||
|
||||
if (empty($rentalInsuranceServices)) {
|
||||
if (empty($rentalInsuranceManagers)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return reset($rentalInsuranceServices); // Get the first (and typically only) rental insurance service
|
||||
return reset($rentalInsuranceManagers); // Get the first (and typically only) rental insurance service
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user