public function moveToParent($newParent, $reason = '') { $newSubject = $newParent->subject(); $original = $this->dbVersion; $oldTopThread = $newParent->topmostThread(); $oldParent = $this->superthread(); $newTopThread = $newParent->topmostThread(); Thread::recursiveSet($this, $newSubject, $newTopThread, $newParent); $newParent->addReply($this); if ($oldParent) { $oldParent->removeReply($this); } $this->dbVersion = $original; $oldTopThread->commitRevision(Threads::CHANGE_MERGED_FROM, $this, $reason); $newParent->commitRevision(Threads::CHANGE_MERGED_TO, $this, $reason); }