I’m still search for a solution how to implement composition with ember-data in a clean way.
An easy example for this use case is an invoice with multiple lines (e.g. like in https://emberigniter.com/saving-models-relationships-json-api/ ). It should be possible to create a new invoice, add lines and store the whole thing at once. Additionally it is possible to edit the invoice and add and delete lines, but the change should be done just when the save button is clicked and not if the delete button on a line is pressed or a new line is added. Additionally the ids for the lines are created in the backend.
I expected to find an easy solution for this common use case, but I didn’t yet.
A workaround could be the usage of fragments, but because the lines are real database records with an unique id, this seams not to be the best matching solution. Other way round with real ember records makes it difficult to implement the create/update/delete just when the invoice is stored.
Has someone an other suggestion?