本文整理匯總了PHP中Group_member::limit方法的典型用法代碼示例。如果您正苦於以下問題:PHP Group_member::limit方法的具體用法?PHP Group_member::limit怎麽用?PHP Group_member::limit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Group_member
的用法示例。
在下文中一共展示了Group_member::limit方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _getNthMem
/**
* Get the Nth most recent group membership for this user
*
* @param User $user The user to get memberships for
* @param integer $n How far to count back
*
* @return Group_member a membership or null
*/
private function _getNthMem($user, $n)
{
$mem = new Group_member();
$mem->profile_id = $user->id;
$mem->orderBy('created DESC');
$mem->limit($n - 1, 1);
if ($mem->find(true)) {
return $mem;
} else {
return null;
}
}
示例2: byMember
/**
* Get stream of memberships by member
*
* @param integer $memberId profile ID of the member to fetch for
* @param integer $offset offset from start of stream to get
* @param integer $limit number of memberships to get
*
* @return Group_member stream of memberships, use fetch() to iterate
*/
static function byMember($memberId, $offset = 0, $limit = GROUPS_PER_PAGE)
{
$membership = new Group_member();
$membership->profile_id = $memberId;
$membership->orderBy('created DESC');
$membership->limit($offset, $limit);
$membership->find();
return $membership;
}
示例3: getMemberIDs
function getMemberIDs($offset = 0, $limit = null)
{
$gm = new Group_member();
$gm->selectAdd();
$gm->selectAdd('profile_id');
$gm->group_id = $this->id;
$gm->orderBy('created DESC');
if (!is_null($limit)) {
$gm->limit($offset, $limit);
}
$ids = array();
if ($gm->find()) {
while ($gm->fetch()) {
$ids[] = $gm->profile_id;
}
}
return $ids;
}