Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.73 KB | None | 0 0
  1. <?php
  2.  
  3. namespace Application\UserBundle\Form;
  4.  
  5. use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
  6. use Doctrine\ODM\MongoDB\DocumentManager;
  7. use FOS\UserBundle\Model\UserInterface;
  8.  
  9. use Symfony\Component\Form\AbstractType;
  10. use Symfony\Component\Form\FormBuilder;
  11.  
  12. class UserFormType
  13. {
  14.  
  15.     public function buildForm(FormBuilder $builder, array $options)
  16.     {
  17.  
  18.         $builder->add('firstname', 'text', array(
  19.           'label'   => 'user.registration.firstname',
  20.           'required'  => true
  21.         ));
  22.         $builder->add('email', 'text', array(
  23.           'label'     => 'user.registration.email',
  24.           'required'  => true
  25.         ));
  26.         $builder->add('plainPassword', 'repeated', array(
  27.           'label'     => 'user.registration.password',
  28.           'type'      => 'password',
  29.           'required'  => true
  30.         ));
  31.         $builder->add('gender', 'choice', array(
  32.           'label'     => 'user.registration.gender',
  33.           'choices'   => array('m' => 'Male', 'f' => 'Female'),
  34.           'expanded'  => true,
  35.           'required'  => true
  36.         ));
  37.         $builder->add('birthday', 'birthday', array(
  38.           'label'     => 'user.registration.birthday',
  39. //          'widget'    => 'choice',
  40.           'input'     => 'string',
  41.           'format'    => \IntlDateFormatter::SHORT,
  42.           'widget'    => 'single_text',
  43.           'required'  => true
  44.         ));
  45.         $builder->add('nationality', 'country', array(
  46.           'label'     => 'user.registration.nationality'
  47.         ));
  48.  
  49.     }
  50.  
  51.     public function getDefaultOptions(array $options)
  52.     {
  53.       $options['validation_groups'] = array('RegistrationBattl');
  54.       return $options;
  55.     }
  56.    
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement