I'm trying to clone/copy my product entity with all of it's children but can get this to work. I use the export/import method but the children are not included and the id stays the same.
function cloneProduct(product) {
console.log("product before export", product);
var exportData = this.manager.exportEntities([product]);
var manager2 = this.manager.createEmptyCopy();
var importData = manager2.importEntities(exportData);
console.log("product after import", importData);
return importData;
}
Can anyone help me?
UPDATE:
For now I'm using the method provided on this question: Breeze create entity from existing one
I don't know that is the correct way to use, but it gets the job done for now.