本文整理汇总了PHP中Thread::getById方法的典型用法代码示例。如果您正苦于以下问题:PHP Thread::getById方法的具体用法?PHP Thread::getById怎么用?PHP Thread::getById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Thread
的用法示例。
在下文中一共展示了Thread::getById方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: write
public function write()
{
$thread = Thread::getById(Param::get('thread_id'));
$comment = new Comment();
$page = Param::get('page_next', 'write');
switch ($page) {
case self::CURRENT_PAGE_WRITE:
break;
case self::RENDER_PAGE_AFTER_WRITE:
$comment->id = $thread->id;
$comment->user_id = get_authenticated_user_id($_SESSION['userid']);
$comment->body = Param::get('body');
try {
$comment->write();
} catch (ValidationException $e) {
$page = self::CURRENT_PAGE_WRITE;
}
break;
default:
throw new NotFoundException("{$page} is not found");
}
$this->set(get_defined_vars());
$this->render($page);
}
示例2: getFollowedThreads
public function getFollowedThreads($session_user)
{
$this->threads_followed = array();
$followed_ids = Follow::getFollowedThreadIds($this->id);
foreach ($followed_ids as $thread) {
$this->threads_followed[] = Thread::getById($thread['thread_id']);
}
Thread::getAttributes($this->threads_followed, $session_user);
}