fix: adopt wrapper dto to dynamic form field

This commit is contained in:
Björn Fromme
2026-03-16 11:59:11 +01:00
parent a74f34b559
commit d31204188b
2 changed files with 6 additions and 2 deletions
+2 -1
View File
@@ -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,
+4 -1
View File
@@ -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)) {