I'm using symfony 2.8 and I'm new to it. I run into a problem that I don't know how to solve it in Symfony way.
I have a customer table and a product table. I don't want my customers to access all of products, but only some of them. So I create a table called Tagging, where I can assign what products a customer can see. Tagging table contains customer_id and product_id. It's a many-to-many relationship.
In backend, I want to create a list to display ALL of the products and a checkbox next to each products and a button 'Save' at the bottom of the page. When I click save, only the checked products are saved to the tagging table. So that in frontend, when the customer views the product list page, he sees only products that have been associated to him. There is a question about Build a form having a checkbox for each entity in a doctrine collection, but I find my case is a bit different because this list is not product list, but actually the tagging list. Product information is inside the tagging. Moreover I don't really like the approach.
One more trouble, because there are about 500+ products in the stock so I have to display them in many pages.
How and what is the best practice for this case in Symfony?
Thanks a lot in advanced!
Aucun commentaire:
Enregistrer un commentaire