I seem to be having an issue with the Thread DataWriter. When I set the new values (new node_id and discussion_state to deleted) and then save, it seems the counters aren't being updated correctly.
However, if I change my code to this (and not delete the thread after moving it):
The counters and forum information update fine. Could anyone explain what the problem is and how to go about resolving it?
My end goal is to have a thread moved from A to B and soft deleted, programmatically.
Code:
$dw = XenForo_DataWriter::create('XenForo_DataWriter_Discussion_Thread');
$dw->setExistingData($threadId);
$dw->set('node_id', $targetNode);
$dw->set('discussion_state', 'deleted');
$dw->save();
However, if I change my code to this (and not delete the thread after moving it):
Code:
$dw = XenForo_DataWriter::create('XenForo_DataWriter_Discussion_Thread');
$dw->setExistingData($threadId);
$dw->set('node_id', $targetNode);
$dw->save();
The counters and forum information update fine. Could anyone explain what the problem is and how to go about resolving it?
My end goal is to have a thread moved from A to B and soft deleted, programmatically.