Edit multiple Entity objects in one form

I have a table with these fields:

id, ch1, ch2, .., ch15 

and 62 lines (id = 1 to 62 and other fields = 0 by default). I need to create a single form where I can edit (not insert and delete) all fields ch1-ch15 in all lines.

I have seen articles on inline forms, but they are all about adding a new row to the database. I only need to edit existing lines.

And now the question is: how can I bind each entity to each form in a collection of inline forms? Or is there another way to solve my problem?

+4
source share
1 answer

With inline forms, you can only edit existing entities in your relationships if you want .

For instance:

If you have a Person object with multiple Address objects.

You need to implement the Person form and the address form.

Inside your face shape, you need to add a widget with a name after the attribute that stores the addresses, and mark this attribute beein the subform (in this case, the address form)

If you save this form and call the $ form-> bind () method, all values ​​will be bound to related objects.

Implementation information read the article on embedded forms inside documents

http://symfony.com/doc/current/book/forms.html#embedded-forms

hope this helps;)

+4
source

Source: https://habr.com/ru/post/1481695/


All Articles