LPH
Well-known member
xf_post includes thread_id.
Which is the most efficient method for checking if a particular thread_id exists?
Code uses thread_id to build a link but if that thread has been deleted then an error is going to happen, therefore, a thread_id check is necessary.
I'm thinking of starting with this model but is there a better way?
This returns an array, then use a foreach looking for the thread_id. This seems rather intensive if there are over a million threads.
Any suggestions? Thank you.
Which is the most efficient method for checking if a particular thread_id exists?
Code uses thread_id to build a link but if that thread has been deleted then an error is going to happen, therefore, a thread_id check is necessary.
I'm thinking of starting with this model but is there a better way?
PHP:
/** @var $threadModel XenForo_Model_Thread */
$threadModel = XenForo_Model::create('XenForo_Model_Thread')->getModelFromCache( 'XenForo_Model_Thread' );
$threads = $threadModel->getThreadsByIds( $thread_ids );
This returns an array, then use a foreach looking for the thread_id. This seems rather intensive if there are over a million threads.
Any suggestions? Thank you.