/** * DO NOT USE THIS METHOD! * * Seriously, you probably don't want to use this method, except from within * this class. * * Although it may seem similar to Title::newFrom* or User::newFrom*, chances are slim to none * that this will do what you'd expect. * * Unlike Title & User etc, a post is not something some object that can be * used in isolation: a post should always be retrieved via it's parents, * via a workflow, ... * * The only reasons we have this method are for creating root posts * (called from PostRevision->create), and so when failing to load a * post, we can create a stub object. * * @param UUID $uuid * @param User $user * @param string $content * @param string $format wikitext|html * @param Title|null $title * @return PostRevision */ public static function newFromId(UUID $uuid, User $user, $content, $format, Title $title = null) { $obj = new self(); $obj->revId = UUID::create(); $obj->postId = $uuid; $obj->user = UserTuple::newFromUser($user); $obj->origUser = $obj->user; $obj->setReplyToId(null); // not a reply to anything $obj->prevRevision = null; // no parent revision $obj->setContent($content, $format, $title); return $obj; }