src/AppBundle/Form/Customer/ContactFormRequestType.php line 22

Open in your IDE?
  1. <?php
  2. namespace AppBundle\Form\Customer;
  3. use AppBundle\Entity\Customer\ContactRequestTime;
  4. use Symfony\Bridge\Doctrine\Form\Type\EntityType;
  5. use Symfony\Component\Form\AbstractType;
  6. use Symfony\Component\Form\Extension\Core\Type\DateType;
  7. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  8. use Symfony\Component\Form\FormBuilderInterface;
  9. use Symfony\Component\OptionsResolver\OptionsResolver;
  10. use Symfony\Component\Validator\Constraints\Length;
  11. use Symfony\Component\Validator\Constraints\NotBlank;
  12. /**
  13.  * Class ContactRequestType
  14.  *
  15.  * Klasa fromularza ContactRequest dla formularza ContactForm
  16.  *
  17.  * @package AppBundle\Form\Customer
  18.  */
  19. class ContactFormRequestType extends AbstractType
  20. {
  21.     /**
  22.      * {@inheritdoc}
  23.      */
  24.     public function buildForm(FormBuilderInterface $builder, array $options)
  25.     {
  26.         $builder
  27.             ->add('name'null, [
  28.                 'label' => false,
  29.                 'attr' => ['class'=> 'form-control form-control-sm''placeholder' => 'ImiÄ™ i nazwisko''required' => true],
  30.                 'translation_domain' => false,
  31.                 'constraints' => [
  32.                     new NotBlank(),
  33.                     new Length(array('min' => 3)),
  34.                 ]
  35.             ])
  36.             ->add('email'EmailType::class, [
  37.                 'label' => false,
  38.                 'attr' => ['class'=> 'form-control form-control-sm''placeholder' => 'Adres e-mail''required' => true],
  39.                 'translation_domain' => false,
  40.                 'constraints' => [
  41.                     new NotBlank(),
  42.                     new Length(array('min' => 3)),
  43.                 ]
  44.             ])
  45.             ->add('phone'null, [
  46.                 'label' => false,
  47.                 'attr' => ['class'=> 'form-control form-control-sm''placeholder' => 'Numer telefonu''required' => true],
  48.                 'translation_domain' => false,
  49.                 'constraints' => [
  50.                     new NotBlank(),
  51.                     new Length(array('min' => 9)),
  52.                 ]
  53.             ])
  54.             ->add('rodo'null, [
  55.                 'label' => false,
  56.                 'attr' => ['class'=> 'form-check-input''required' => true],
  57.                 'translation_domain' => false,
  58.                 'constraints' => [
  59.                     new NotBlank()
  60.                 ]
  61.             ])
  62.         ;
  63.     }
  64.     /**
  65.      * {@inheritdoc}
  66.      */
  67.     public function configureOptions(OptionsResolver $resolver)
  68.     {
  69.         $resolver->setDefaults(array(
  70.             'data_class' => 'AppBundle\Entity\Customer\ContactRequest'
  71.         ));
  72.     }
  73.     /**
  74.      * {@inheritdoc}
  75.      */
  76.     public function getBlockPrefix()
  77.     {
  78.         return 'appbundle_customer_contactformrequest';
  79.     }
  80. }