chore: streamline property naming

This commit is contained in:
Björn Fromme
2025-09-19 16:09:27 +02:00
parent 096dd96db0
commit c9a258a350
18 changed files with 99 additions and 71 deletions
+6 -6
View File
@@ -214,7 +214,7 @@ class BookingEditParticipantType extends AbstractType
return $attributes;
};
$form
->add('transportationServiceTo', ChoiceType::class, [
->add('transportationOutbound', ChoiceType::class, [
...$commonChoiceFieldOptions,
'label' => 'Anreise',
'required' => true,
@@ -222,7 +222,7 @@ class BookingEditParticipantType extends AbstractType
'choices' => $options['selectable_transportation_services_to'],
'choice_attr' => $transportationChoiceAttributes,
])
->add('transportationServiceFro', ChoiceType::class, [
->add('transportationInbound', ChoiceType::class, [
...$commonChoiceFieldOptions,
'label' => 'Rückreise',
'required' => true,
@@ -232,7 +232,7 @@ class BookingEditParticipantType extends AbstractType
]);
// Pickup
$form->add('pickup', ChoiceType::class, [
$form->add('pickupOutbound', ChoiceType::class, [
'label' => 'Zustieg',
'multiple' => false,
'expanded' => false,
@@ -319,12 +319,12 @@ class BookingEditParticipantType extends AbstractType
}
}
$transportationId = $data['transportationServiceTo'] ?? null;
$transportationId = $data['transportationOutbound'] ?? null;
$transportation = $options['travel']->pickups[$transportationId] ?? null;
if (null !== $transportation && 'PKW' === $transportation->subType) {
$form->remove('pickup');
unset($data['pickup']);
$form->remove('pickupOutbound');
unset($data['pickupOutbound']);
}
// forcibly select mandatory services that potentially have been disabled in PRE_SET_DATA
+1 -1
View File
@@ -46,7 +46,7 @@ class BookingEditType extends AbstractType
->getTransportationServicesByDirection('HIN', false),
'selectable_transportation_services_fro' => $travelData
->getTransportationServicesByDirection('RUECK', false),
'selectable_pickups' => $travelData->pickupsTo,
'selectable_pickups' => $travelData->pickupsOutbound,
'personal_data_mutable' => $travelData->participantDataMutable,
'additional_services_mutable' => $travelData->additionalServicesMutable,
'transportation_services_mutable' => $travelData->transportationServicesMutable,
-5
View File
@@ -58,14 +58,9 @@ class BookingEditDto implements BookingDtoInterface
$participantData->transportationOutbound = $outboundTransportation;
$participantData->transportationInbound = $inboundTransportation;
// Backward compatibility: also set deprecated properties
$participantData->transportationServiceTo = $outboundTransportation;
$participantData->transportationServiceFro = $inboundTransportation;
// Pickup handling (currently only supports outbound pickup)
$pickupOutbound = $booking->getPickupForParticipant($index);
$participantData->pickupOutbound = $pickupOutbound;
$participantData->pickup = $pickupOutbound; // Backward compatibility
$instance->participants[$index] = $participantData;
}
+5 -5
View File
@@ -71,11 +71,6 @@ class ParticipantDto
// License plate for participants with parking (optional, visible only when parking is selected)
public ?string $licensePlate = null;
// Deprecated properties for backward compatibility - will be removed in future version
public ?Service $transportationServiceTo = null;
public ?Service $transportationServiceFro = null;
public ?Pickup $pickup = null;
public static function fromPersonalData(PersonalData $personalData): static
{
$instance = new static();
@@ -98,6 +93,11 @@ class ParticipantDto
return $instance;
}
public function isApplicant(): bool
{
return 0 === $this->index;
}
public function isCanceled(): bool
{
return 'S' === $this->status;
@@ -328,7 +328,7 @@ class ParticipantFieldOptionsProvider extends AbstractFieldOptionsProvider
// Outbound Pickup (conditional - only shown when outbound transportation is bus)
$this->fieldOptionProviders['pickupOutbound'] = fn (BookingDtoInterface $bookingDto, int $participantIndex, array $options = []) => [
'label' => 'Zustieg Hinfahrt',
'choices' => $bookingDto->travel->pickupsTo,
'choices' => $bookingDto->travel->pickupsOutbound,
'choice_label' => fn (?Pickup $pickup) => $this->formatPickupLabelWithPrice($pickup),
'choice_value' => 'id',
'expanded' => false, // Dropdown for pickups
@@ -340,7 +340,7 @@ class ParticipantFieldOptionsProvider extends AbstractFieldOptionsProvider
// Inbound Pickup (conditional - only shown when inbound transportation is bus)
$this->fieldOptionProviders['pickupInbound'] = fn (BookingDtoInterface $bookingDto, int $participantIndex, array $options = []) => [
'label' => 'Ausstieg Rückfahrt',
'choices' => $bookingDto->travel->pickupsFro,
'choices' => $bookingDto->travel->pickupsInbound,
'choice_label' => fn (?Pickup $pickup) => $this->formatPickupLabelWithPrice($pickup),
'choice_value' => 'id',
'expanded' => false,
@@ -64,7 +64,7 @@ class ParticipantPickupInboundFieldHandler extends AbstractParticipantFieldHandl
// Validate pickup selection against available inbound pickups
$validSelection = null;
if (null !== $selectedPickup) {
$validSelection = $this->findValidPickup($selectedPickup, $bookingDto->travel->pickupsFro);
$validSelection = $this->findValidPickup($selectedPickup, $bookingDto->travel->pickupsInbound);
}
$participant->pickupInbound = $validSelection;
@@ -65,7 +65,7 @@ class ParticipantPickupOutboundFieldHandler extends AbstractParticipantFieldHand
// Validate pickup selection against available outbound pickups
$validSelection = null;
if (null !== $selectedPickup) {
$validSelection = $this->findValidPickup($selectedPickup, $bookingDto->travel->pickupsTo);
$validSelection = $this->findValidPickup($selectedPickup, $bookingDto->travel->pickupsOutbound);
}
$participant->pickupOutbound = $validSelection;
@@ -14,7 +14,7 @@ use App\Form\Service\Abstract\AbstractParticipantFieldHandler;
*
* This handler manages rental equipment selections for participants in the booking
* creation process. It processes the rentals field from form submissions,
* filters out age-inappropriate options and duration-inappropriate options, and
* filters out age-inappropriate options and duration-inappropriate options, and
* updates the participant DTO with only valid selections.
*
* Dependencies: dateOfBirth (for age evaluation) and skiPass (for duration filtering)
@@ -68,7 +68,7 @@ class ParticipantRentalsFieldHandler extends AbstractParticipantFieldHandler
if (null === $participant->skiPass) {
// No skipass selected = clear all rental selections
$participant->rentals = [];
return;
}