src/BlogBundle/Form/UserType.php
/**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
@param FormBuilderInterface $builder
@param array $options
@param FormBuilderInterface $builder @param array $options
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $permissions = array(
            'Becario'   => 'ROLE_BECARIO',
            'Usuario'   => 'ROLE_USER',
            'Admin'     => 'ROLE_ADMIN',
            'SuperAdmin' => 'ROLE_SUPER_ADMIN'
        );
        $builder
            ->add('name',TextType::class, array("label"=>"Nombre:","required"=>false, "attr" =>array(
				"class" => "form-name form-control",
			)))
            ->add('surname',TextType::class, array("label"=>"Apellido","required"=>false, "attr" =>array(
				"class" => "form-surname form-control",
			)))
            ->add('email',EmailType::class, array(
                "label"=>"Email", 
                'required' => true, 
                "attr" =>array(
    				"class" => "form-email form-control",
    			)))
            ->add('password',RepeatedType::class, array(
                'type' => PasswordType::class,
                'required' => true,
                'invalid_message' => 'Las contraseñas deben coincidir',
                'first_options'  => array('label' => 'Contraseña'),
                'second_options' => array('label' => 'Confirmar contraseña'),
                "attr" =>array(
    				"class" => "form-password form-control",
    			)))
            ->add('roles', ChoiceType::class,array(
                "label" => "Roles:",
                'choices' => $permissions,
                'required' => true,
                'multiple'=>true, 
                'expanded'=>true, 
                "attr" =>array("class" => "form-control")
            ))
            ->add('birthday', DateType::class, array(
                'widget' => 'single_text',
                'format' => 'yyyy-MM-dd',
                'html5' => false,
                'attr' => ['data-toggle' => 'datepicker'],
            ))
			->add('Guardar', SubmitType::class, array("attr" =>array(
				"class" => "form-submit btn btn-success",
			)))
        ;
    }
public function buildForm ( FormBuilderInterface $ builder , array $ options ) { $ permissions = array ( 'Becario' => 'ROLE_BECARIO' , 'Usuario' => 'ROLE_USER' , 'Admin' => 'ROLE_ADMIN' , 'SuperAdmin' => 'ROLE_SUPER_ADMIN' ) ; $ builder -> add ( 'name' , TextType :: class , array ( " label " => " Nombre: " , " required " => false , " attr " => array ( " class " => " form-name form-control " , ) ) ) -> add ( 'surname' , TextType :: class , array ( " label " => " Apellido " , " required " => false , " attr " => array ( " class " => " form-surname form-control " , ) ) ) -> add ( 'email' , EmailType :: class , array ( " label " => " Email " , 'required' => true , " attr " => array ( " class " => " form-email form-control " , ) ) ) -> add ( 'password' , RepeatedType :: class , array ( 'type' => PasswordType :: class , 'required' => true , 'invalid_message' => 'Las contraseñas deben coincidir', 'first_options' => array ( 'label' => 'Contraseña') , 'second_options' => array ( 'label' => 'Confirmar contraseña') , " attr " => array ( " class " => " form-password form-control " , ) ) ) -> add ( 'roles' , ChoiceType :: class , array ( " label " => " Roles: " , 'choices' => $ permissions , 'required' => true , 'multiple' => true , 'expanded' => true , " attr " => array ( " class " => " form-control " ) ) ) -> add ( 'birthday' , DateType :: class , array ( 'widget' => 'single_text' , 'format' => 'yyyy-MM-dd' , 'html5' => false , 'attr' => [ 'data-toggle' => 'datepicker' ] , ) ) -> add ( 'Guardar' , SubmitType :: class , array ( " attr " => array ( " class " => " form-submit btn btn-success " , ) ) ) ; }
@param FormBuilderInterface $builder
 @param array $options
@param FormBuilderInterface $builder @param array $options
//Seleccion multiple //Para mostrar checkbox en vez de desplegable // this is actually the default format for single_text //'years' => range(1940,2000),