SHARE
TWEET

Untitled

a guest Apr 13th, 2013 33 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. namespace Sefida\UserBundle\Form\Type;
  4.  
  5. use Symfony\Component\Form\AbstractType;
  6. use Symfony\Component\Form\FormBuilderInterface;
  7. use Symfony\Component\OptionsResolver\OptionsResolverInterface;
  8.  
  9. class UserType extends AbstractType
  10. {
  11.     public function buildForm(FormBuilderInterface $builder, array $options) {
  12.         $builder
  13.             ->add('username', 'text', array(
  14.                 'label' => 'user.form.label.username'
  15.             ))
  16.             ->add('email', 'email', array(
  17.                 'label' => 'user.form.label.email'
  18.             ))
  19.             ->add('firstName', 'text', array(
  20.                 'label' => 'user.form.label.first_name'
  21.             ))
  22.             ->add('secondName', 'text', array(
  23.                 'label' => 'user.form.label.second_name'
  24.             ))
  25.             ->add('password', 'repeated', array(
  26.                 'type' => 'password',
  27.                 'first_name' => 'password',
  28.                 'second_name' => 'confirm',
  29.                 'first_options' => array('label' => 'user.form.label.first_password'),
  30.                 'second_options' => array('label' => 'user.form.label.second_password'),
  31.             ))
  32.             ->add('roles', 'entity', array(
  33.                 'required' => true,
  34.                 'class' => 'Sefida\UserBundle\Entity\Role',
  35.                 'property' => 'name',
  36.                 'empty_value' => 'user.form.label.role_empty',
  37.                 'label' => 'user.form.label.role'
  38.             ));
  39.     }
  40.  
  41.     /**
  42.      * Returns the name of this type.
  43.      *
  44.      * @return string The name of this type
  45.      */
  46.     public function getName() {
  47.         return 'User';
  48.     }
  49. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top