Skip to content

Commit 0bedb97

Browse files
Cloned model should be a new record, and should have no PK value
1 parent 9c328df commit 0bedb97

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/Model.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,6 +1291,9 @@ public function reload()
12911291

12921292
public function __clone()
12931293
{
1294+
$this->__new_record = true;
1295+
$pk = $this->get_primary_key(true);
1296+
$this->assign_attribute($pk, null);
12941297
$this->__relationships = array();
12951298
$this->reset_dirty();
12961299
return $this;

0 commit comments

Comments
 (0)