本文整理汇总了PHP中entryPeer::setOrder方法的典型用法代码示例。如果您正苦于以下问题:PHP entryPeer::setOrder方法的具体用法?PHP entryPeer::setOrder怎么用?PHP entryPeer::setOrder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类entryPeer
的用法示例。
在下文中一共展示了entryPeer::setOrder方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUserFavorites
/**
* This function returns a pager object holding the given user's favorite entries
* each entry holds the kuser object of its host.
*
* @param int $kuserId = the requested user
* @param int $type = the favorite type (currently only SUBJECT_TYPE_ENTRY will match)
* @param int $privacy = the privacy filter
* @param int $pageSize = number of kshows in each page
* @param int $page = the requested page
* @return the pager object
*/
public static function getUserFavorites($kuserId, $type, $privacy, $pageSize, $page, $order = entry::ENTRY_SORT_MOST_VIEWED)
{
$c = new Criteria();
entryPeer::setOrder($c, $order);
$c->addJoin(entryPeer::KUSER_ID, kuserPeer::ID, Criteria::INNER_JOIN);
$c->addJoin(entryPeer::ID, favoritePeer::SUBJECT_ID, Criteria::INNER_JOIN);
$c->add(favoritePeer::KUSER_ID, $kuserId);
$c->add(favoritePeer::SUBJECT_TYPE, $type);
$c->add(favoritePeer::PRIVACY, $privacy);
$c->setDistinct();
// our assumption is that a request for private favorites should include public ones too
if ($privacy == favorite::PRIVACY_TYPE_USER) {
$c->addOr(favoritePeer::PRIVACY, favorite::PRIVACY_TYPE_WORLD);
}
$c->addAscendingOrderByColumn(entryPeer::NAME);
$pager = new sfPropelPager('entry', $pageSize);
$pager->setCriteria($c);
$pager->setPage($page);
$pager->setPeerMethod('doSelectJoinkuser');
$pager->setPeerCountMethod('doCountJoinkuser');
$pager->init();
return $pager;
}