Change an update to an insert

Is it possible to switch a active record back to insert mode once it has been populated with a pre-existing row? So that when I call $model->save() or $model->insert it inserts a new row rather than updating the current one.

I realise I can do this with a myModel::model->insert(… but that would be long winded and I wondered if there was a shortcut.

I’ve tried calling $model->insert, but I get an error.

Also tried setting the primary key to null; just inserts it as a zero.

This seems to work

$model->isNewRecord = true;

$model->primaryKey = null;


Thanks Tommy

Thought I’d tried that; must be getting late.