I am working on Symfony, I am facing a problem I have 2 table:
I want to create a form to display options to the users to select the category, enter some details and then submit.
But I don't no know how to combine 2 entity in one form and create a form.
I had created all the code from commend tools
Please help me or update me show I can share the full files.
Both examples below are in full so study them and use whichever fits in your needs. You can modify as you wish. Because they are a bit long, I haven't read all of it but what I can say is, they give you an idea which way to go when dealing multiple forms in a single form.
Example 1:
Full webform style CRUD example with an embedded associated entity in symfony uses "embedded entity" style form builder where parent entity is given as selecbox.
Example 2:
Creating a combined formtype by embedding individual formtypes for one-to-many association in symfony combines two individual form types into one.
Example 3:
Many-to-many association example in symfony uses entity mapping in form builder and I think this would give you more flexibility to show what field you want to use in your form.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.