Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace Sefida\UserBundle\Form\Type;
- use Symfony\Component\Form\AbstractType;
- use Symfony\Component\Form\FormBuilderInterface;
- use Symfony\Component\OptionsResolver\OptionsResolverInterface;
- class UserType extends AbstractType
- {
- public function buildForm(FormBuilderInterface $builder, array $options) {
- $builder
- ->add('username', 'text', array(
- 'label' => 'user.form.label.username'
- ))
- ->add('email', 'email', array(
- 'label' => 'user.form.label.email'
- ))
- ->add('firstName', 'text', array(
- 'label' => 'user.form.label.first_name'
- ))
- ->add('secondName', 'text', array(
- 'label' => 'user.form.label.second_name'
- ))
- ->add('password', 'repeated', array(
- 'type' => 'password',
- 'first_name' => 'password',
- 'second_name' => 'confirm',
- 'first_options' => array('label' => 'user.form.label.first_password'),
- 'second_options' => array('label' => 'user.form.label.second_password'),
- ))
- ->add('roles', 'entity', array(
- 'required' => true,
- 'class' => 'Sefida\UserBundle\Entity\Role',
- 'property' => 'name',
- 'empty_value' => 'user.form.label.role_empty',
- 'label' => 'user.form.label.role'
- ));
- }
- /**
- * Returns the name of this type.
- *
- * @return string The name of this type
- */
- public function getName() {
- return 'User';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement