ATK Data - Deep Copy feature


DeepCopy is a feature we would like to implement natively in ATK Data. Currently you can duplicate and make a copy of a single record, and that can be done between 2 model types or even from one persistence to another.

With Deep Copy it will be also possible to copy related data. For example you may have a wizard which creates invoice with lines, tags but storing all the data in session. Once user confirms, it would deepCopy everything into persistence (such as SQL). No more “draft” documents.

Naturally we also want to copy multiple records and also reconstruct relationships. Copy will work consistently even if you copy between different types. E.G you could be copying from SQL into RestAPI.

$associations = $invoice->deepCopy($archived_invoices, ['Lines']);
$associations = $payment->deepCopy($archived_payments, ['Allocations'], $associations);

Deep Copy is explained here: $associations = $invoice->deepCopy($archived_invoices, [‘Lines’]);
$associations = $payment->deepCopy($archived_payments, [‘Allocations’], $associations);

Please use this thread to discuss.