本文整理匯總了PHP中Thread::bulkLoad方法的典型用法代碼示例。如果您正苦於以下問題:PHP Thread::bulkLoad方法的具體用法?PHP Thread::bulkLoad怎麽用?PHP Thread::bulkLoad使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Thread
的用法示例。
在下文中一共展示了Thread::bulkLoad方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: loadFromResult
static function loadFromResult($res, $db, $bulkLoad = false)
{
$rows = array();
$threads = array();
foreach ($res as $row) {
$rows[] = $row;
if (!$bulkLoad) {
$threads[$row->thread_id] = Thread::newFromRow($row);
}
}
if (!$bulkLoad) {
return $threads;
}
return Thread::bulkLoad($rows);
}
示例2: getThreads
/**
* Returns an array of structures. Each structure has the keys 'top' and 'posts'.
* 'top' contains the top-level thread to display.
* 'posts' contains an array of integer post IDs which should be highlighted.
*/
function getThreads()
{
$rows = $this->getRows();
if (!count($rows)) {
return false;
}
$threads = Thread::bulkLoad($rows);
$thread_ids = array_keys($threads);
$output = array();
foreach ($threads as $id => $thread) {
$output[$id] = array('top' => $thread, 'posts' => array());
}
$dbr = wfGetDB(DB_SLAVE);
$res = $dbr->select(array('user_message_state'), array('ums_thread', 'ums_conversation'), array('ums_user' => $this->user->getId(), 'ums_conversation' => $thread_ids), __METHOD__);
foreach ($res as $row) {
$top = $row->ums_conversation;
$thread = $row->ums_thread;
$output[$top]['posts'][] = $thread;
}
return $output;
}
示例3: replies
function replies()
{
if (!$this->id()) {
return array();
}
if (!is_null($this->replies)) {
$this->checkReplies($this->replies);
return $this->replies;
}
$this->dieIfHistorical();
// Check cache
if (isset(self::$replyCacheById[$this->id()])) {
return $this->replies = self::$replyCacheById[$this->id()];
}
$this->replies = array();
$dbr = wfGetDB(DB_SLAVE);
$res = $dbr->select('thread', '*', array('thread_parent' => $this->id(), 'thread_type != ' . $dbr->addQuotes(Threads::TYPE_DELETED)), __METHOD__);
$rows = array();
foreach ($res as $row) {
$rows[] = $row;
}
$this->replies = Thread::bulkLoad($rows);
$this->checkReplies($this->replies);
return $this->replies;
}
示例4: getPageThreads
function getPageThreads($pager)
{
$rows = $pager->getRows();
return Thread::bulkLoad($rows);
}