src/Form/ContactType.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use Symfony\Component\Form\AbstractType;
  4. use Symfony\Component\Form\FormBuilderInterface;
  5. use Symfony\Component\Validator\Constraints\NotBlank;
  6. use Symfony\Component\Validator\Constraints\Email;
  7. use Symfony\Component\Validator\Constraints\Collection;
  8. use Symfony\Component\OptionsResolver\OptionsResolver;
  9. use Symfony\Component\Form\Extension\Core\Type\TextType;
  10. use Symfony\Component\Form\Extension\Core\Type\SubmitType;
  11. class ContactType extends AbstractType
  12. {
  13.     public function buildForm(FormBuilderInterface $builder, array $options)
  14.     {
  15. //        $builder->add('email', 'text',array('label'=>'Ingrese el email'));
  16.         $builder->add('usuario'TextType::class,array('label'=>'Ingrese el Usuario'));
  17.         
  18.         $builder->add('clave', \Symfony\Component\Form\Extension\Core\Type\PasswordType::class,array('label'=>'Ingrese la clave'));
  19. //        $builder->add('message', 'text',array('label'=>'Ingrese un Mesaje'));
  20.    
  21.     }
  22.    
  23.     public function getDefaultOptions(array $options)
  24.     {
  25.         $collectionConstraint = new Collection(array(
  26.             //'email' => new Email(),
  27.             'usuario' => new NotBlank(),
  28.             'clave' => new NotBlank(),
  29.             //'message' => new NotBlank(),
  30.         ));
  31.         
  32.         $options['validation_constraint'] = $collectionConstraint;
  33.         return $options;
  34.     }
  35.     
  36.    
  37.     public function getName()
  38.     {
  39.         return 'contact';
  40.     }
  41. }