You need to copy ORM data from one model to another:
// save current data
$data = $orm1->as_array();
$orm2 = new Model1();
$orm2->values($data);
$orm2->save();
This example uses separate ORM objects. You can load values back to $orm1
, but don't forget to call $orm1->clear()
before $orm1->values($data)
. This resets the model to its unloaded state.
Note that as_array
will also return belongs_to
relationships.