src/Form/SearchForm.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use App\Data\SearchData;
  4. use Symfony\Bridge\Doctrine\Form\Type\EntityType;
  5. use Symfony\Component\Form\AbstractType;
  6. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  7. use Symfony\Component\Form\Extension\Core\Type\NumberType;
  8. use Symfony\Component\Form\Extension\Core\Type\TextType;
  9. use Symfony\Component\Form\FormBuilderInterface;
  10. use Symfony\Component\OptionsResolver\OptionsResolver;
  11. class SearchForm extends AbstractType
  12. {
  13.     public function buildForm(FormBuilderInterface $builder, array $options)
  14.     {
  15.         $builder
  16.             ->add('largeur'ChoiceType::class, [
  17.                 'choices' => [
  18.                     '135' => '135',
  19.                     '145' => '145',
  20.                     '155' => '155',
  21.                     '165' => '165',
  22.                     '175' => '175',
  23.                     '185' => '185',
  24.                     '195' => '195',
  25.                     '205' => '205',
  26.                     '215' => '215',
  27.                     '225' => '225',
  28.                     '235' => '235',
  29.                     '245' => '245',
  30.                     '255' => '255',
  31.                     '265' => '265',
  32.                     '275' => '275',
  33.                     '285' => '285',
  34.                     '295' => '295',
  35.                     '305' => '305',
  36.                     '315' => '315',
  37.                 ],
  38.                 'label' => false,
  39.                 'placeholder' => 'Toutes les largeurs',
  40.                 'required' => true,
  41.                 'data' => "205",
  42.             ])
  43.             ->add('hauteur'ChoiceType::class, [
  44.                 'choices' => [
  45.                     '30' => '30',
  46.                     '35' => '35',
  47.                     '40' => '40',
  48.                     '45' => '45',
  49.                     '50' => '50',
  50.                     '55' => '55',
  51.                     '60' => '60',
  52.                     '65' => '65',
  53.                     '70' => '70',
  54.                     '75' => '75',
  55.                     '80' => '80',
  56.                     '85' => '85',
  57.                     '90' => '90',
  58.                 ],
  59.                 'label' => false,
  60.                 'placeholder' => 'Toutes les hauteurs',
  61.                 'required' => true,
  62.                 'data' => "55",
  63.             ])
  64.             ->add('marque'ChoiceType::class, [
  65.                 'choices' => [
  66.                     'Toutes les marques' => '',
  67.                     'Premium' => [
  68.                         'Bridgestone' => 'Bridgestone',
  69.                         'Continental' => 'Continental',
  70.                         'Dunlop' => 'Dunlop',
  71.                         'Goodyear' => 'Goodyear',
  72.                         'Hankook' => 'Hankook',
  73.                         'Michelin' => 'Michelin',
  74.                         'Pirelli' => 'Pirelli',
  75.                     ],
  76.                     'Qualité' => [
  77.                         'Falken' => 'Falken',
  78.                         'Firestone' => 'Firestone',
  79.                         'Fulda' => 'Fulda',
  80.                         'Kleber' => 'Kleber',
  81.                         'Kumho' => 'Kumho',
  82.                         'Laufenn' => 'Laufenn',
  83.                         'Maxxis' => 'Maxxis',
  84.                         'Nokian' => 'Nokian',
  85.                         'Nexen' => 'Nexen',
  86.                         'Riken' => 'Riken',
  87.                         'Toyo' => 'Toyo',
  88.                         'Uniroyal' => 'Uniroyal',
  89.                         'Yokohama' => 'Yokohama',
  90.                     ],
  91.                     'Budget' => [
  92.                         'Aplus' => 'Aplus',
  93.                         'Austone' => 'Austone',
  94.                         'Autogreen' => 'Autogreen',
  95.                         'Compasal' => 'Compasal',
  96.                         'CST' => 'CST',
  97.                         'Dayton' => 'Dayton',
  98.                         'Debica' => 'Debica',
  99.                         'Evergreen' => 'Evergreen',
  100.                         'Firemax' => 'Firemax',
  101.                         'Fortuna' => 'Fortuna',
  102.                         'Goodride' => 'Goodride',
  103.                         'Gremax' => 'Gremax',
  104.                         'Haida' => 'Haida',
  105.                         'Headway' => 'Headway',
  106.                         'Hifly' => 'Hifly',
  107.                         'Infinity' => 'Infinity',
  108.                         'Insa Turbo' => 'Insa Turbo',
  109.                         'Landsail' => 'Landsail',
  110.                         'Lanvigator' => 'Lanvigator',
  111.                         'Leao' => 'Leao',
  112.                         'Leonard' => 'Leonard',
  113.                         'Linglong' => 'Linglong',
  114.                         'Maxtrek' => 'Maxtrek',
  115.                         'Mazzini' => 'Mazzini',
  116.                         'Nankang' => 'Nankang',
  117.                         'Ovation' => 'Ovation',
  118.                         'Powertrac' => 'Powertrac',
  119.                         'Roadstone' => 'Roadstone',
  120.                         'Rovela' => 'Rovela',
  121.                         'Sailun' => 'Sailun',
  122.                         'Sava' => 'Sava',
  123.                         'Starmaxx' => 'Starmaxx',
  124.                         'Superia' => 'Superia',
  125.                         'Tomket' => 'Tomket',
  126.                         'Tracmax' => 'Tracmax',
  127.                         'Trazano' => 'Trazano',
  128.                         'Wanli' => 'Wanli',
  129.                         'Westlake' => 'Westlake',
  130.                         'Zeetex' => 'Zeetex',
  131.                     ],
  132.                 ],
  133.                 'label' => false,
  134.                 'placeholder' => 'Toutes les marques',
  135.                 'required' => false,
  136.             ])
  137.             ->add('vitesse'ChoiceType::class, [
  138.                 'choices' => [
  139.                     'Q < 160 km/h' => 'Q < 160 km/h',
  140.                     'R < 170 km/h' => 'R < 170 km/h',
  141.                     'S < 180 km/h' => 'S < 180 km/h',
  142.                     'U < 200 km/h' => 'U < 200 km/h',
  143.                     'T < 190 km/h' => 'T < 190 km/h',
  144.                     'H < 210 km/h' => 'H < 210 km/h',
  145.                     'V < 240 km/h' => 'V < 240 km/h',
  146.                     'W < 270 km/h' => 'W < 270 km/h',
  147.                 ],
  148.                 'label' => false,
  149.                 'placeholder' => 'Toutes les vitesses',
  150.                 'required' => false,
  151.                 'data' => "V < 240 km/h",
  152.             ])
  153.             ->add('diametre'ChoiceType::class, [
  154.                 'choices' => [
  155.                     "12" => "12",
  156.                     "13" => "13",
  157.                     "14" => "14",
  158.                     "15" => "15",
  159.                     "16" => "16",
  160.                     "17" => "17",
  161.                     "18" => "18",
  162.                     "19" => "19",
  163.                     "20" => "20",
  164.                     "21" => "21",
  165.                     "22" => "22",
  166.                 ], 
  167.                 'label' => false,
  168.                 'placeholder' => 'Toutes les diametres',
  169.                 'required' => true,
  170.                 'data' => "16",
  171.             ]) 
  172.             ->add('charge'ChoiceType::class, [
  173.                 'choices' => [
  174.                     "60" => "60",
  175.                     "61" => "61",
  176.                     "62" => "62",
  177.                     "63" => "63",
  178.                     "64" => "64",
  179.                     "65" => "65",
  180.                     "66" => "66",
  181.                     "67" => "67",
  182.                     "68" => "68",
  183.                     "69" => "69",
  184.                     "70" => "70",
  185.                     "71" => "71",
  186.                     "72" => "72",
  187.                     "73" => "73",
  188.                     "74" => "74",
  189.                     "75" => "75",
  190.                     "76" => "76",
  191.                     "77" => "77",
  192.                     "78" => "78",
  193.                     "79" => "79",
  194.                     "80" => "80",
  195.                     "81" => "81",
  196.                     "82" => "82",
  197.                     "83" => "83",
  198.                     "84" => "84",
  199.                     "85" => "85",
  200.                     "86" => "86",
  201.                     "87" => "87",
  202.                     "88" => "88",
  203.                     "89" => "89",
  204.                     "90" => "90",
  205.                     "91" => "91",
  206.                     "92" => "92",
  207.                     "93" => "93",
  208.                     "94" => "94",
  209.                     "95" => "95",
  210.                     "96" => "96",
  211.                     "97" => "97",
  212.                     "98" => "98",
  213.                     "99" => "99",
  214.                     "100" => "100",
  215.                     "101" => "101",
  216.                     "102" => "102",
  217.                     "103" => "103",
  218.                     "104" => "104",
  219.                     "105" => "105",
  220.                     "106" => "106",
  221.                     "107" => "107",
  222.                     "108" => "108",
  223.                     "109" => "109",
  224.                     "110" => "110",
  225.                     "111" => "111",
  226.                     "112" => "112",
  227.                     "113" => "113",
  228.                     "114" => "114",
  229.                     "115" => "115",
  230.                     "116" => "116",
  231.                     "117" => "117",
  232.                     "118" => "118",
  233.                     "119" => "119",
  234.                 ],
  235.                 'label' => false,
  236.                 'placeholder' => 'Toutes les charges',
  237.                 'required' => false,
  238.                 'data' => "91",
  239.             ]) 
  240.             ->add('saison'ChoiceType::class, [
  241.                 'choices' => [
  242.                     "Été" => "Été",
  243.                     "Hiver" => "Hiver",
  244.                     "4 saisons" => "4 saisons",
  245.                 ],
  246.                 'label' => false,
  247.                 'placeholder' => 'Toutes les saisons',
  248.                 'required' => false,
  249.                 'data' => "Été",
  250.             ])
  251.             ->add('specificite'ChoiceType::class, [
  252.                 'choices' => [
  253.                     "Renforcé" => "Renforcé",
  254.                     "Runflat" => "Runflat",
  255.                     "Silent" => "Silent",
  256.                 ], 'placeholder' => '------------------',
  257.                 'label' => false,
  258.                 'placeholder' => 'Aucune',
  259.                 'required' => false,
  260.             ])
  261.             // ->add('categories', EntityType::class, array(
  262.             //     'class' => Category::class,
  263.             //     'choice_label' => 'name',
  264.             //     'label' => false,
  265.             //     'placeholder' => 'All categories',
  266.             //     'required' => false,
  267.             //     'choice_translation_domain' => 'messages',
  268.             // ))
  269.             ;
  270.     }
  271.     public function configureOptions(OptionsResolver $resolver)
  272.     {
  273.         $resolver->setDefaults([
  274.             'data_class' => SearchData::class,
  275.             'method' => 'GET',
  276.             'csrf_protection' => false,
  277.         ]);
  278.     }
  279.     public function getBlockPrefix()
  280.     {
  281.         return '';
  282.     }
  283. }