Skip to content

Instantly share code, notes, and snippets.

@haruta
Created August 24, 2012 11:12
Show Gist options
  • Save haruta/3449248 to your computer and use it in GitHub Desktop.
Save haruta/3449248 to your computer and use it in GitHub Desktop.
function copy_row($fromid, $overwride = array()) {
$fom = $this->db->getTable('table')->find($fromid);
$to = $this->db->getTable('table')->create();
$to->fromArray(array_merge($overwride, $from->toArray()));
$to->save();
}
$new_row = copy_row(1, array('id' => null));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment