src/Form/SearchType.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use App\classe\Search;
  4. use App\Entity\Admin\PropretyType;
  5. use Symfony\Bridge\Doctrine\Form\Type\EntityType;
  6. use Symfony\Component\Form\AbstractType;
  7. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  8. use Symfony\Component\Form\Extension\Core\Type\TextType;
  9. use Symfony\Component\Form\FormBuilderInterface;
  10. use Symfony\Component\OptionsResolver\OptionsResolver;
  11. class SearchType extends AbstractType
  12. {
  13.    public function buildForm(FormBuilderInterface $builder, array $options)
  14.    {
  15.        $builder
  16.            ->add('city'TextType::class,[
  17.                'label'=>false,
  18.                'attr'=>[
  19.                    'class'=>'form-control border-0 py-3 ',
  20.                    'placeholder'=>'Ville'
  21.                ],
  22.                'required'=>false
  23.            ])
  24.            ->add('categorie'EntityType::class,[
  25.                'label'=>false,
  26.                'class'=>PropretyType::class,
  27.                'choice_label'=>'title',
  28.                'required'=>false,
  29.                'multiple'=>false,
  30.                'expanded'=>false,
  31.                'attr'=>[
  32.                    'class'=>'form-select border-0 py-3',
  33.                ],
  34.                'placeholder'=>'Type de bien'
  35.            ])
  36.            ->add('isToSal'ChoiceType::class, [
  37.                'label'=>false,
  38.                'choices'=>[
  39.                    'À louer'=>'À louer',
  40.                    'À vendre'=>'À vendre'
  41.                ],
  42.                'required'=>false,
  43.                'attr'=>[
  44.                    'class'=>'form-select border-0 py-3',
  45.                ],
  46.                'multiple'=>false,
  47.                'expanded'=>false,
  48.                'placeholder'=>'Choisissez à louer ou à vendre'
  49.            ])
  50.        ;
  51.    }
  52.    public function configureOptions(OptionsResolver $resolver)
  53.    {
  54.        $resolver->setDefaults([
  55.            'data_class'=>Search::class,
  56.            'method'=>'GET',
  57.            'csrf_protection'=>false
  58.        ]);
  59.    }
  60.    public function getBlockPrefix()
  61.    {
  62.        return '';
  63.    }
  64. }