chore: remove debug statements
This commit is contained in:
@@ -36,15 +36,8 @@ class DateOfBirthProvidedCondition implements FieldConditionInterface
|
||||
public function evaluate(BookingDto $bookingDto, int $participantIndex, array $formData): bool
|
||||
{
|
||||
$participant = $bookingDto->getParticipant($participantIndex);
|
||||
$result = null !== $participant && null !== $participant->dateOfBirth;
|
||||
|
||||
error_log(sprintf('[DOB Condition] Participant %d: dateOfBirth=%s, result=%s',
|
||||
$participantIndex,
|
||||
$participant?->dateOfBirth?->format('Y-m-d') ?? 'NULL',
|
||||
$result ? 'TRUE' : 'FALSE'
|
||||
));
|
||||
|
||||
return $result;
|
||||
return null !== $participant && null !== $participant->dateOfBirth;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -100,10 +100,6 @@ class ParticipantAdditionalServicesFieldHandler extends AbstractParticipantField
|
||||
// Extract current service selections from submitted data
|
||||
$selectedServices = $this->getFieldValue($submittedData, $this->getFieldName()) ?? [];
|
||||
|
||||
// Debug: Log what was submitted
|
||||
$submittedIds = array_map(fn($s) => is_object($s) ? $s->id : $s, $selectedServices);
|
||||
error_log(sprintf('[AdditionalServices] Participant %d: Submitted service IDs: [%s]', $participantIndex, implode(', ', $submittedIds)));
|
||||
|
||||
// Get available additional services from travel data
|
||||
$availableServices = $bookingDto->travel->getAdditionalServicesBySubTypes(Constants::TOKEN_ADDITIONAL);
|
||||
|
||||
@@ -115,10 +111,6 @@ class ParticipantAdditionalServicesFieldHandler extends AbstractParticipantField
|
||||
$participantIndex
|
||||
);
|
||||
|
||||
// Debug: Log what passed validation
|
||||
$validIds = array_map(fn($s) => $s->id, $validSelections);
|
||||
error_log(sprintf('[AdditionalServices] Participant %d: Valid service IDs after filtering: [%s]', $participantIndex, implode(', ', $validIds)));
|
||||
|
||||
// Update participant with validated selections
|
||||
$participant->additionalServices = $validSelections;
|
||||
}
|
||||
@@ -181,33 +173,17 @@ class ParticipantAdditionalServicesFieldHandler extends AbstractParticipantField
|
||||
$service = $this->findServiceInAvailableServices($selectedService, $availableServices);
|
||||
|
||||
if (null === $service) {
|
||||
error_log(sprintf('[AdditionalServices] Participant %d: Service %s NOT FOUND in available services', $participantIndex, is_object($selectedService) ? $selectedService->id : $selectedService));
|
||||
return false; // Service not found in available services
|
||||
}
|
||||
|
||||
// Check if service has age constraints
|
||||
$ageEvaluator = new ServiceAgeEvaluator();
|
||||
if (false === $ageEvaluator->canEvaluate($service)) {
|
||||
error_log(sprintf('[AdditionalServices] Participant %d: Service %d (%s) has NO age constraints - VALID', $participantIndex, $service->id, $service->label));
|
||||
return true; // No age restrictions, service is valid
|
||||
}
|
||||
|
||||
// Validate service against participant's age
|
||||
$isValid = $ageEvaluator->isServiceAvailableForParticipant($service, $bookingDto, $participantIndex);
|
||||
$participant = $bookingDto->getParticipant($participantIndex);
|
||||
$age = $participant?->getAge($bookingDto->travel->dateFrom);
|
||||
|
||||
error_log(sprintf(
|
||||
'[AdditionalServices] Participant %d (age %s): Service %d (%s) age validation = %s. Constraints: %s',
|
||||
$participantIndex,
|
||||
$age ?? 'unknown',
|
||||
$service->id,
|
||||
$service->label,
|
||||
$isValid ? 'VALID' : 'INVALID',
|
||||
$ageEvaluator->getConstraintDescription($service)
|
||||
));
|
||||
|
||||
return $isValid;
|
||||
return $ageEvaluator->isServiceAvailableForParticipant($service, $bookingDto, $participantIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -82,8 +82,6 @@ class ParticipantFieldHandlerRegistry
|
||||
*/
|
||||
public function processFieldsAndSync(array $submittedData, BookingDto $bookingDto): array
|
||||
{
|
||||
error_log(sprintf('[ProcessFieldsAndSync] Mode: %s', $bookingDto->getMode()));
|
||||
|
||||
// Process all field handlers to clean the DTO
|
||||
$this->processFields($submittedData, $bookingDto);
|
||||
|
||||
@@ -332,8 +330,6 @@ class ParticipantFieldHandlerRegistry
|
||||
*/
|
||||
private function syncParticipantData(array $participantData, ParticipantDto $participant, int $index, BookingDto $bookingDto): array
|
||||
{
|
||||
error_log(sprintf('[Sync] Participant %d fields in submission: %s', $participant->index ?? -1, implode(', ', array_keys($participantData))));
|
||||
|
||||
// Sync fields for all registered handlers
|
||||
foreach ($this->handlers as $fieldName => $handler) {
|
||||
// Only sync fields that were in the original submission
|
||||
@@ -341,7 +337,6 @@ class ParticipantFieldHandlerRegistry
|
||||
if (property_exists($participant, $fieldName) && array_key_exists($fieldName, $participantData)) {
|
||||
$dtoValue = $participant->{$fieldName};
|
||||
$participantData[$fieldName] = $this->convertDtoValueToSubmittedFormat($dtoValue);
|
||||
error_log(sprintf('[Sync] Participant %d: synced %s', $participant->index ?? -1, $fieldName));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user