Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 8th, 2012  |  syntax: None  |  size: 0.75 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. FosUserbundle and symfony 2 template and edits
  2. services:
  3.   my_user.profile.form.type:
  4.     class: MyUserBundleFormTypeProfileFormType
  5.     arguments: [%fos_user.model.user.class%]
  6.     tags:
  7.         - { name: form.type, alias: my_user_profile }
  8.  
  9. fos_user:
  10.   profile:
  11.     form:
  12.       type: my_user_profile
  13.        
  14. <?php
  15.  
  16. namespace MyUserBundleFormType;
  17.  
  18. use SymfonyComponentFormFormBuilder;
  19. use FOSUserBundleFormTypeProfileFormType as BaseType;
  20.  
  21. class ProfileFormType extends BaseType
  22. {
  23.  
  24.     public function getName()
  25.     {
  26.         return 'my_user_profile';
  27.     }
  28.  
  29.     protected function buildUserForm(FormBuilder $builder, array $options)
  30.     {
  31.         $builder
  32.         ->add('email', 'email')
  33.         ->add('firstName')
  34.         ->add('lastName')
  35.         ;
  36.     }
  37. }