]>
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)) |
e4977b8a J |
16 | ->add('password', 'password', array( |
17 | 'constraints' => array( | |
18 | new Constraints\Length(array( | |
19 | 'min' => 8, | |
20 | 'minMessage' => 'Password should by at least 8 chars long', | |
21 | )), | |
22 | new Constraints\NotBlank(), | |
23 | ), | |
24 | )) | |
4d6e818e | 25 | ->add('email', 'email') |
e4977b8a J |
26 | ->add('save', 'submit') |
27 | ; | |
28 | } | |
29 | ||
75e9d1df | 30 | public function configureOptions(OptionsResolver $resolver) |
e4977b8a J |
31 | { |
32 | $resolver->setDefaults(array( | |
33 | 'data_class' => 'Wallabag\CoreBundle\Entity\User', | |
34 | )); | |
35 | } | |
36 | ||
37 | public function getName() | |
38 | { | |
39 | return 'new_user'; | |
40 | } | |
41 | } |