本文整理匯總了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);
}