This repository has been archived by the owner. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I had an issue with the synchronisation of _ids in collection links.
Some were not updated and it seems it was a dangling reference in a for loop since it was consistently the same ones every time.
This update fixes the dangling reference so the new _ids taken from the $idsMapping array are always applied without being lost in subsequent loops.
Not sure if this is related to #3 since that seems to be more about them not restoring at all. However, I do not have that problem with the code as it is. My PR only fixes the dangler and it also leaves the save until even later than your suggested alternative to that PR and does it after the nested loops are all completed and so sends the full $entries array just once.
EDIT:
I've made a further change to allow for both single item and multiple item collection links. Now I think I know what #3 was about. That user obviously had all their collection links set to multiple:false. With the code as it was, none would have been processed. The proposed change might have reversed the issue and processed all the single item collection links and none of the multiple item collection links. This update will process both.