diff --git a/lib/ktentity.inc b/lib/ktentity.inc index c59cfa4..a82c0e9 100644 --- a/lib/ktentity.inc +++ b/lib/ktentity.inc @@ -111,6 +111,19 @@ class KTEntity { return false; } + function newCopy() { + $sClass = get_class($this); + $oObject =& new $sClass; + foreach (array_keys($this->_aFieldToSelect) as $k) { + $oObject->$k = $this->$k; + } + $oObject->iId = -1; + $oObject->create(); + + $iId = $oObject->iId; + return KTEntityUtil::get($sClass, $iId); + } + /** * Update the values in the database table with the object's current values *