简体   繁体   中英

How to create a switch form in Symfony2?

For my project in symfony I need to create a certain form. The Entities and Controllers were not an issue but now that it comes to the form and view file I am stuck as to how to approach this. I am using twig and would like to use the Symfony forms.

   | Option A | Option B | Option C |
-------+----------+----------+----------+
Type A |     x    |     x    |     x    |
-------+----------+----------+----------+
Type B |     x    |     x    |     x    |
-------+----------+----------+----------+
Type C |     x    |     x    |     x    |
-------+----------+----------+----------+

The x represents a checkbox. Using this form the user can select a different amount of options for each Type. The types are stored in an entity as are the options.

How would i do something like this the Symfony way?

Edit

What I want to to is to get the results from the Type entity and the results from my Option entity. The Type entity will supply the rows for a table and the Option entity will supply the columns. Each row will have a checkbox under every column. This is so that I can select multiple options for each type.

I need to build a form from both these entities and I can't figure out how to approach this issue.

Check this bundle . I never use it but has a pretty good reputation.

Hope this help you.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM