Symfony: how to relation a Entity field to several Entities

     

My database diagram corresponds to:


(image)


Each table has his own Symfony Entity class. My app view shows:


(image)


I need to associate a Discount Entity to multiple entities: Sneaker Tshirt Trouser or even more entities.


First solution:


Create N:N tables between discounts and the others. The problem is that I could need create new tables to apply discount and then I would have to create more N:N tables. So I discard this solution.


Second solution:


Create a generic table with to_entity and to_entity_id fields that let me map discount to to_entity entity destination (Sneaker