Hi,
could you please confirm if the same happens in your case:
After saving a form, in which sfWidgetFormDmPaginatedDoctrineChoice (default doctrine widget for many to many relations in diem 5.4) is present all records, that were connected to edited record, and were not on first page of widgets' paginated list of records are no longer connected.
I took a look at the code (in Base<ModelName>Form::save<RealtionName>List method) and there's nothing that would prevent such bahavior because $values passed to this method aro only a subset of those 20 (or any other max_per_page): let's say 10 of them selected.
What is being done by this method is unlinking all but those given form current page of widget.
Look at this scenario:
* set max_per_page to infinite
* select all
* save
* set max_per_page to 10
* refresh
* (off course 10 are selected)
* save
* go to the second page
none on the second page (and following pages) is selected
What's even stranger: try this scenario:
* select something on 1st page,
* go to 2nd page, selecting another entity
* go back to 1st page
* save
All entities selected in this scenario are actually selected after save.
Though those ones on 3rd page and following are unlinked.
The only way I know not to unlink them is to set max_per_page to infinite just before saving (inconvenient) or use old sfWidgetFormDmDoctrineChoice (not optimal for 1000s of entities as it is in my case).
Tell me please if it happens to you and how do you deal with this.