• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Loading an Extended DataWriter outside of XenForo


We have extended XenForo_DataWriter_DiscussionMessage_Post with the class Techspot_DataWriter_DiscussionMessage_Post which has custom functionality for _messagePostSave and _messagePreSave.

Outside the XenForo environment we do something like this to save comments on news articles:
        $writer = XenForo_DataWriter::create('XenForo_DataWriter_DiscussionMessage_Post');
        $writer->set('user_id', ...);
        $writer->set('username', ...);
        $writer->set('message', ...);
        $writer->set('ip_id', ...);
        $writer->set('thread_id', ...);
But when we instantiate the DataWriter this way it doesn't get extended with Techspot_DataWriter_DiscussionMessage_Post class. Is there anyway we can instantiate directly Techspot_DataWriter_DiscussionMessage_Post, when we try instantiating it directly the autoloader doesn't find XFCP_Techspot_DataWriter_DiscussionMessage_Post which is a class that's resolved dynamically when running inside XenForo.