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