1. 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

Discussion in 'XenForo Development Discussions' started by Mario Estrada, May 10, 2012.

  1. Mario Estrada

    Mario Estrada New Member

    Hi,

    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:
    PHP:
            $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', ...);
            
    $writer->save();
    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.
     
  2. ragtek

    ragtek Guest

    Jake Bunce and Mario Estrada like this.
  3. Mario Estrada

    Mario Estrada New Member

    Thanks that worked flawlessly.
     

Share This Page