src/Form/TestType.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use Symfony\Component\Form\AbstractType;
  4. use Symfony\Component\Form\FormBuilderInterface;
  5. use Symfony\Component\OptionsResolver\OptionsResolver;
  6. use Symfony\Component\Form\Extension\Core\Type\NumberType;
  7. use Symfony\Component\Form\Extension\Core\Type\DateType;
  8. use Symfony\Bridge\Doctrine\Form\Type\EntityType;
  9. class TestType extends AbstractType
  10. {
  11. public function buildForm(FormBuilderInterface $builder, array $options)
  12. {
  13. $builder
  14. ->add('id', NumberType::class)
  15. ->add('dateOfBirth', DateType::class)
  16. ->add('hospital', EntityType::class,[
  17. 'class'=> \App\Entity\Hospital::class,
  18. 'group_by'=>'municipality.subdivision.city',
  19. ])
  20. ;
  21. }
  22. public function configureOptions(OptionsResolver $resolver)
  23. {
  24. $resolver->setDefaults([
  25. // Configure your form options here
  26. ]);
  27. }
  28. }