I'm trying to get a good Symfony3 solution for a Form containing checkboxes. The total number of checkboxes are retrieved from one table (the CategoryList table) and in another table I've stored which Categories for a certain domain are selected.
Table: CategoryList ID CategoryName 1 Unknown 2 Cat-1 3 Cat-2
Table: DomainCategory ID Domain_ID DomainCategoryList_ID 1 1 1 2 1 2 3 1 3 4 2 2 5 3 1
The DomainCategory table contains the relationship between the Domains and the categories to which the Domains belong to.
How can I create a Symfony3 form for this?
I tried to use the EntityType::class and passing the CategoryList object to it, then I get indeed all the Categories as checkboxes but I cannot specify which checkbox needs to be checked/ticked depending on the DomainCategory table.
Any suggestions on how to solve this? Or any good reference to an example implementation. I was not able to find it after spending a week solving this problem.
Aucun commentaire:
Enregistrer un commentaire