If I have a many-to-many relationship it's super easy to update the relationship with its sync method.
But what would I use to synchronize a one-to-many relationship?
- table posts:id, name
- table links:id, name, post_id
Here, each Post can have multiple Links.
I'd like to synchronize the links associated with a specific post in the database, against an inputted collection of links (for example, from a CRUD form where I can add, remove, and modify links).
Links in the database that aren't present in my input collection should be removed. Links that exist in the database and in my input should be updated to reflect the input, and links that are only present in my input should be added as new records in the database.
To summarize the desired behavior:
- inputArray = true / db = false ---CREATE
- inputArray = false / db = true ---DELETE
- inputArray = true / db = true ----UPDATE
 
     
     
     
     
     
     
     
    