public function __clone() { foreach ($this->Rows as $TableName => $Rows) { $this->Rows[$TableName] = clone $this->Rows[$TableName]; $this->PrimaryKeys[$TableName] = $this->Rows[$TableName]->GetPrimaryKey(); } }