FosUserbundle and symfony 2 template and edits

后端 未结 2 1598
清歌不尽
清歌不尽 2021-01-07 09:27

I am new to symfony 2. I have just setup with basic FOSuserbundle. But I have a few problems:

  1. I have setup the new layout template but I could not find wher

2条回答
  •  攒了一身酷
    2021-01-07 10:18

    Answers on your questions you can find inside documentation. Here are some points:

    1. Copy templates you want to modify from FOSUserBundle/Resources/views into your bundle and do changes you want.
    2. If you need to make a custom profile form (as I guess based on your question), then you have to create profile form type and specify that FOSUserBundle uses it.

    config.yml

    services:
      my_user.profile.form.type:
        class: My\UserBundle\Form\Type\ProfileFormType
        arguments: [%fos_user.model.user.class%]
        tags:
            - { name: form.type, alias: my_user_profile }
    
    fos_user:
      profile:
        form:
          type: my_user_profile
    

    ProfileFormType.php

    add('email', 'email')
            ->add('firstName')
            ->add('lastName')
            ;
        }
    }
    

提交回复
热议问题