P
P
Prudkovski2014-11-05 01:22:14
symfony
Prudkovski, 2014-11-05 01:22:14

FosUserBundle: profile editing in different forms?

Good day to all!
Tell me how to implement editing profile attributes in different forms? Those. I need to have multiple edit forms like "name", "phone and address" and so on.
I found something similar in the documentation symfony.com/doc/current/cookbook/form/form_collect...
But maybe there is a simpler algorithm?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
B
Boris Benkovsky, 2014-11-05
@prudkovski

What you found is a collection of entities, that is, using this mechanism, you can add several new entities at once, on one form (for example, several new tags at once)
As far as I understand, you just need to edit one entity, but in different places of the application with different sets of attributes. Just use multiple forms.

class FirstEditForm extends ..... 
{
   public function build($builder) {
      $builder->add('username');
  }
}

class SecondEditForm extends ..... 
{
  public function build($builder) {
    $builder->add('location');
    $builder->add('number');
  }
}

and display them in different places, and it will change different parts of your profile for you

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question