I want to implement a system of category and their associated options in Symfony 2.
So a Category (example: car, Home) have categoryOption (example: date, color, size, etc…).
Moreover, the Category entities have many to one relationship with the advert entity. I mean an Advert can have only one Category but infinite Advert can be attached to a Category. So, at the end, I want to be able to make a dynamic form like that:
If I select a category (ex: caravanning), all of the attached subcategory will appear like that:
And allow the user to select or enter the desired information.
I already have implemented the Category and Advert entity but I don’t know what schema to use for the options and how to generate the form. Do I have to create a new categoryOption entity and make a relationship with Advert and Category or use another way?
Of course, the categoryOption attached to the advert can be edited by the user.