- Fixed the problem of initial (default) values (Trac #172) when creating an object by factorizing: creation / modification and cloning of objects !

SVN:trunk[663]
This commit is contained in:
Denis Flaven
2010-08-05 17:10:35 +00:00
parent 9a70c6f82d
commit db8c287925
4 changed files with 69 additions and 200 deletions

View File

@@ -915,6 +915,18 @@ abstract class DBObject
$this->m_iKey = $iNewKey;
return $this->DBInsert();
}
/**
* This function is automatically called after cloning an object with the "clone" PHP language construct
* The purpose of this method is to reset the appropriate attributes of the object in
* order to make sure that the newly cloned object is really distinct from its clone
*/
public function __clone()
{
$this->m_bIsInDB = false;
$this->m_bDirty = true;
$this->m_iKey = self::GetNextTempId(get_class($this));
}
// To be optionaly overloaded
protected function OnUpdate()