S
S
s0lar2018-04-01 23:29:12
symfony
s0lar, 2018-04-01 23:29:12

How to edit multiple records of one Entity in one form?

I have an entity - Settings (fields var, value)
And I need to display 10 records from Settings for editing at once in one form.
How to build a form so that you can edit 10 records (var, value) and save on pressing 1 button?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Kuznetsov, 2018-04-02
@s0lar

Roughly speaking, output an array, there will be id, key and value. Send as a collection of objects or JSON, save to the database in a loop.
UPD.
The Symfony documentation has a standard example of how to work with collections via forms.
It seems to be here - https://symfony.com/doc/current/form/form_collecti... you can see.

C
CodeKeeper, 2018-04-02
@CodeKeeper

https://symfony.com/doc/current/form/embedded.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question