]>
Commit | Line | Data |
---|---|---|
e4977b8a | 1 | <?php |
4346a860 | 2 | |
e4977b8a J |
3 | namespace Wallabag\CoreBundle\Form\Type; |
4 | ||
5 | use Symfony\Component\Form\AbstractType; | |
6 | use Symfony\Component\Form\FormBuilderInterface; | |
75e9d1df | 7 | use Symfony\Component\OptionsResolver\OptionsResolver; |
e4977b8a J |
8 | use Symfony\Component\Validator\Constraints; |
9 | ||
10 | class NewUserType extends AbstractType | |
11 | { | |
12 | public function buildForm(FormBuilderInterface $builder, array $options) | |
13 | { | |
14 | $builder | |
4d6e818e | 15 | ->add('username', 'text', array('required' => true)) |
fcb1fba5 NL |
16 | ->add('plainPassword', 'repeated', array( |
17 | 'type' => 'password', | |
e4977b8a J |
18 | 'constraints' => array( |
19 | new Constraints\Length(array( | |
20 | 'min' => 8, | |
21 | 'minMessage' => 'Password should by at least 8 chars long', | |
22 | )), | |
23 | new Constraints\NotBlank(), | |
24 | ), | |
25 | )) | |
4d6e818e | 26 | ->add('email', 'email') |
e4977b8a J |
27 | ->add('save', 'submit') |
28 | ; | |
29 | } | |
30 | ||
75e9d1df | 31 | public function configureOptions(OptionsResolver $resolver) |
e4977b8a J |
32 | { |
33 | $resolver->setDefaults(array( | |
34 | 'data_class' => 'Wallabag\CoreBundle\Entity\User', | |
35 | )); | |
36 | } | |
37 | ||
38 | public function getName() | |
39 | { | |
40 | return 'new_user'; | |
41 | } | |
42 | } |