src/Form/SearchByKeywordsForm.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use Symfony\Component\Form\AbstractType;
  4. use Symfony\Component\Form\Extension\Core\Type\SubmitType;
  5. use Symfony\Component\Form\Extension\Core\Type\TextType;
  6. use Symfony\Component\Form\FormBuilderInterface;
  7. use Symfony\Component\Validator\Constraints\Length;
  8. use Symfony\Component\Validator\Constraints\NotBlank;
  9. class SearchByKeywordsForm extends AbstractType
  10. {
  11.     public function buildForm(FormBuilderInterface $builder, array $options)
  12.     {
  13.         $builder
  14.             ->add('keywords'TextType::class, [
  15.                 'constraints' => [
  16.                     new NotBlank(),
  17.                     new Length(['min' => 2]),
  18.                 ],
  19.             ])
  20.             ->add('search'SubmitType::class)
  21.         ;
  22.         return $builder->getForm();
  23.     }
  24. }