ForestForTrees
Well-known member
Hello,
Is it good practice to use the datawriter on 'node_id' code to move a thread from one subforum to another? Or is there a higher-level way to do it that might be more modular?
Example code: (source: tutorial by Fuhrmann)
Is it good practice to use the datawriter on 'node_id' code to move a thread from one subforum to another? Or is there a higher-level way to do it that might be more modular?
Example code: (source: tutorial by Fuhrmann)
Code:
$threads = $threadModel->getThreads($conditionals, $fetchOptions);
foreach ($threads as $thread)
{
$dw = XenForo_DataWriter::create('XenForo_DataWriter_Discussion_Thread');
$dw->setExistingData($thread);
$dw->set('node_id', $cronOptions['toForum']);
$dw->save();
}