From d31204188bb1b484920d66ee8f2f445a116c78e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Thu, 23 Oct 2025 11:38:34 +0200 Subject: [PATCH] fix: adopt wrapper dto to dynamic form field --- src/Form/BodyDimensionsType.php | 3 ++- src/Form/BookingParticipantType.php | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Form/BodyDimensionsType.php b/src/Form/BodyDimensionsType.php index ef85ac3..d459d57 100644 --- a/src/Form/BodyDimensionsType.php +++ b/src/Form/BodyDimensionsType.php @@ -2,6 +2,7 @@ namespace App\Form; +use App\Form\Model\ParticipantDto; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\FormBuilderInterface; @@ -55,7 +56,7 @@ class BodyDimensionsType extends AbstractType public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ - 'inherit_data' => true, + 'data_class' => ParticipantDto::class, 'height_required' => false, 'weight_required' => false, 'shoeSize_required' => false, diff --git a/src/Form/BookingParticipantType.php b/src/Form/BookingParticipantType.php index 4ca10f9..b86a063 100644 --- a/src/Form/BookingParticipantType.php +++ b/src/Form/BookingParticipantType.php @@ -311,7 +311,10 @@ class BookingParticipantType extends AbstractType } // Add property_path for wrapper DTO navigation - $fieldOptions['property_path'] = 'participant.'.$fieldName; + $propertyPath = $fieldOptions['property_path'] ?? $fieldName; + if (false === str_starts_with($propertyPath, 'participant.')) { + $fieldOptions['property_path'] = 'participant.'.$propertyPath; + } // Apply non-hidden field states (readonly, disabled, required) if (true === $this->fieldStateProvider->hasStateConditions($fieldName)) {