fix: adopt wrapper dto to dynamic form field
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Form;
|
namespace App\Form;
|
||||||
|
|
||||||
|
use App\Form\Model\ParticipantDto;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
@@ -55,7 +56,7 @@ class BodyDimensionsType extends AbstractType
|
|||||||
public function configureOptions(OptionsResolver $resolver): void
|
public function configureOptions(OptionsResolver $resolver): void
|
||||||
{
|
{
|
||||||
$resolver->setDefaults([
|
$resolver->setDefaults([
|
||||||
'inherit_data' => true,
|
'data_class' => ParticipantDto::class,
|
||||||
'height_required' => false,
|
'height_required' => false,
|
||||||
'weight_required' => false,
|
'weight_required' => false,
|
||||||
'shoeSize_required' => false,
|
'shoeSize_required' => false,
|
||||||
|
|||||||
@@ -311,7 +311,10 @@ class BookingParticipantType extends AbstractType
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add property_path for wrapper DTO navigation
|
// 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)
|
// Apply non-hidden field states (readonly, disabled, required)
|
||||||
if (true === $this->fieldStateProvider->hasStateConditions($fieldName)) {
|
if (true === $this->fieldStateProvider->hasStateConditions($fieldName)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user