Reputation: 4190
Let's say that the entity Foo
has many entities Bar
.
In views/Foo/new.html
I want to create many entities Bar
in the same form, allowing to the user add many groups of HTML fields each time that the user clicks on a button "Add". When the user submits the form, I want to create all entities and the new Foo
related with all Bars
.
What is the best approach to do it in Symfony2?
Upvotes: 0
Views: 73
Reputation: 4304
You can do that with the embedded collection of forms. There is pretty good documentation about that at Symfony's website - http://symfony.com/doc/current/cookbook/form/form_collections.html
Upvotes: 1