public function save($all = false) { foreach ($this->__Core->GetRawFields() as $field_name => $def) { $this->__HISTORY_YAPO->{$field_name} = $this->{$field_name}; } $id = parent::save(); $pk = $this->__HISTORY_YAPO->primarykey(); $this->__HISTORY_YAPO->{$pk} = $id; $this->__HISTORY_YAPO->save(); return $id; }
function promote() { if ($this->__Core->PrimaryKeyIsSet()) { $pkid = $this->pkvalue(); $this->clear(); $this->pkvalue($pkid); $this->find(); $parent = $this->__PARENT_FIELD; $this->{$parent} = 0; parent::save(); } }