I have 2 Doctrine Entities with many-to-many relations. When I edit the first entity I want to be able to select the checkboxes that have the data from the 2nd entity to establish the joins for particular entry.
It works fine on creating a new Entry (using Array Collection), but when I want to edit an Entry - it adds the ones that I have selected without removing the previous choice (unchecking).
Which way would be the correct way to do that and how?
- Remove all the Join table data for the Entry that is being updated, then set the new data. (How can I remove it from the join table that is not an Entity?)
- Pass all the data from the 2nd Entity and remove those that aren't checked (seems super-clumsy?)
- Some other way I am not aware of?
I am not using Symfony, just Doctrine.