Guest User

Untitled

a guest
Dec 9th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.24 KB | None | 0 0
  1. ...
  2. sonata_user:
  3. security_acl: false
  4. manager_type: orm # can be orm or mongodb
  5. profile:
  6. register:
  7. form:
  8. type: custom_user_registration
  9. handler: sonata.user.registration.form.handler.default
  10. name: sonata_user_registration_form
  11. validation_groups:
  12. # Defaults:
  13. - myRegistration
  14. - Default
  15. ...
  16.  
  17. ApplicationSonataUserBundleEntityUser:
  18. constraints:
  19. - SymfonyBridgeDoctrineValidatorConstraintsUniqueEntity: email
  20. properties:
  21. email:
  22. - NotBlank:
  23. groups: [myRegistration]
  24. - Email:
  25. groups: [myRegistration]
  26. checkMX: true
  27. plainPassword:
  28. - NotBlank:
  29. groups: [myRegistration]
  30. - Length:
  31. groups: [myRegistration]
  32. min: 6
  33. max: 1024
  34. minMessage: "[T]PASWORD_IS_SHORT[/T]"
  35.  
  36. class RegistrationFormType extends AbstractType {
  37.  
  38. public function buildForm(FormBuilderInterface $builder, array $options) {
  39. $builder->remove('username')
  40. ->remove('email')
  41. ->remove('plainPassword');
  42. $builder
  43. ->add('email', 'email', array(
  44. 'label' => '[T]EMAIL[/T]',
  45. 'translation_domain' => 'FOSUserBundle'
  46. ))
  47. ->add('plainPassword', 'repeated', array(
  48. 'type' => 'password',
  49. 'options' => array('translation_domain' => 'FOSUserBundle'),
  50. 'first_options' => array('label' => '[T]PASSWORD[/T]'),
  51. 'second_options' => array('label' => '[T]PASSWORD_CONFIRM[/T]'),
  52. 'invalid_message' => 'fos_user.password.mismatch',
  53. ))
  54. ->add('us_reportable_agreement', 'choice', array(
  55. 'label_attr' => array('class' => 'centered_label'),
  56. 'label' => '[T]US_REPORTABLE_AGREEMENT[/T]',
  57. 'required' => true,
  58. 'expanded'=>true,
  59. 'multiple'=>false,
  60. 'choices' => array('accept' => '[T]US_REPORTABLE_AGREEMENT_ACCEPT[/T]', 'decline' => '[T]US_REPORTABLE_AGREEMENT_DECLINE[/T]'),
  61. ));
  62. }
Add Comment
Please, Sign In to add comment