I have the following model:
One “Entry” has n “Tags”
I use a dynamic (javascript) form to edit the tags from my entry. I followed the Symfony Cookbook to implement this.
But I have problems when I remove tags and add new ones at the same time.
For example Tags get deleted which souldn’t.
I know where the problem is originated:
Symfony assignes the submitted fields to the entities by their positions in the form. Since in the form every tag has only the field for its actual value (no id) there is no relation between the submittet fields and the entities.
So how can i deal with this? My first thougt would be to add a hidden field for every tag which contains the id of it. But is this the right way to do this in Symfony? And if yes, how can I implement this?
I had an error in my javascript which sometimes caused new fields to get a duplicate name.