<?php
namespace App\Form;
use App\classe\Search;
use App\Entity\Admin\PropretyType;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class SearchType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('city', TextType::class,[
'label'=>false,
'attr'=>[
'class'=>'form-control border-0 py-3 ',
'placeholder'=>'Ville'
],
'required'=>false
])
->add('categorie', EntityType::class,[
'label'=>false,
'class'=>PropretyType::class,
'choice_label'=>'title',
'required'=>false,
'multiple'=>false,
'expanded'=>false,
'attr'=>[
'class'=>'form-select border-0 py-3',
],
'placeholder'=>'Type de bien'
])
->add('isToSal', ChoiceType::class, [
'label'=>false,
'choices'=>[
'À louer'=>'À louer',
'À vendre'=>'À vendre'
],
'required'=>false,
'attr'=>[
'class'=>'form-select border-0 py-3',
],
'multiple'=>false,
'expanded'=>false,
'placeholder'=>'Choisissez à louer ou à vendre'
])
;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class'=>Search::class,
'method'=>'GET',
'csrf_protection'=>false
]);
}
public function getBlockPrefix()
{
return '';
}
}