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