DbObject.php: forget autoinc on clone

This commit is contained in:
Thomas Gelf 2016-03-08 22:24:53 +01:00
parent 5b853879b0
commit 1c395037c3
1 changed files with 10 additions and 1 deletions

View File

@ -517,6 +517,15 @@ abstract class DbObject
return null; return null;
} }
protected function forgetAutoincId()
{
if (isset($this->properties[$this->autoincKeyName])) {
$this->properties[$this->autoincKeyName] = null;
}
return $this;
}
/** /**
* Liefert das benutzte Datenbank-Handle * Liefert das benutzte Datenbank-Handle
* *
@ -876,7 +885,7 @@ abstract class DbObject
public function __clone() public function __clone()
{ {
$this->onClone(); $this->onClone();
$this->autoincKeyName = null; $this->forgetAutoincId();
$this->loadedFromDb = false; $this->loadedFromDb = false;
$this->hasBeenModified = true; $this->hasBeenModified = true;
} }