XF 2.0 Programatically creating a thread with a specified date

Is it possible, when using the following code, to set the date for the post? I see no methods for this on the reflection class.

PHP:
$user = \XF::em()->find('XF:User', $data['user_id']);
$forum = \XF::em()->find('XF:Forum', $data['forum_id']);
\XF::asVisitor($user, function() use ($forum, $data) {
    $creator = \XF::service('XF:Thread\Creator', $forum);
    $creator->setContent($data['title'], $data['message']);
   //....
    $creator->save();
});

I'm trying to set a custom "posted date" so I can backdate a few things.

Thanks in advance!
 
Here's how I achieved this for now until I find out if it's the recommended way.

PHP:
    //.. after $creator->save();
    $creator->getThread()->set('post_date', $date_unix);
    $creator->getThread()->save();
 
Back
Top Bottom