本文整理汇总了PHP中ARSelectFilter::setGrouping方法的典型用法代码示例。如果您正苦于以下问题:PHP ARSelectFilter::setGrouping方法的具体用法?PHP ARSelectFilter::setGrouping怎么用?PHP ARSelectFilter::setGrouping使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ARSelectFilter
的用法示例。
在下文中一共展示了ARSelectFilter::setGrouping方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSubscriptionStatusImpl
private function getSubscriptionStatusImpl($forceRecheck)
{
if ($this->isRecurring->get() == false) {
return false;
// not even a recurring order.
}
$rebillsLeft = $this->rebillsLeft->get();
if ($rebillsLeft == -1 || $rebillsLeft > 0) {
return self::ACTIVE_SUBSCRIPTION;
}
// if order is invoice
$filter = new ARSelectFilter();
$filter->setCondition(new EqualsCond(new ARFieldHandle(__CLASS__, 'parentID'), $this->getID()));
$filter->addField('(SELECT SUM(IF(CustomerOrder.rebillsLeft >= 0, CustomerOrder.rebillsLeft, 0 )))', '', 'rebillsLeft');
$filter->addField('(SELECT SUM(IF(CustomerOrder.rebillsLeft = -1, 1, 0 )))', '', 'isInfinite');
$filter->setGrouping(new ARFieldHandle(__CLASS__, 'parentID'));
$data = ActiveRecordModel::getRecordSetArray(__CLASS__, $filter);
if (count($data) == 1 && ($data[0]['isInfinite'] > 0 || $data[0]['rebillsLeft'] > 0)) {
return self::ACTIVE_SUBSCRIPTION;
}
return false;
}
示例2: getOrderArray
private function getOrderArray(ARSet $orders)
{
$orderArray = $orders->toArray();
$ids = array();
foreach ($orderArray as $key => $order) {
$ids[$order['ID']] = $key;
}
ClassLoader::import('application.model.order.OrderNote');
$f = new ARSelectFilter(new INCond(new ARFieldHandle('OrderNote', 'orderID'), empty($ids) ? array(-1) : array_keys($ids)));
$f->mergeCondition(new EqualsCond(new ARFieldHandle('OrderNote', 'isAdmin'), 1));
$f->mergeCondition(new EqualsCond(new ARFieldHandle('OrderNote', 'isRead'), 0));
$f->setGrouping(new ARFieldHandle('OrderNote', 'orderID'));
$query = new ARSelectQueryBuilder();
$query->setFilter($f);
$query->includeTable('OrderNote');
$query->removeFieldList();
$query->addField('COUNT(*)', null, 'cnt');
$query->addField('orderID');
foreach (ActiveRecordModel::getDataBySQL($query->getPreparedStatement(ActiveRecord::getDBConnection())) as $res) {
$orderArray[$ids[$res['orderID']]]['unreadMessageCount'] = $res['cnt'];
}
return $orderArray;
}
示例3: getActiveDates
private function getActiveDates()
{
$date = date("Y-m-d");
$f = new ARSelectFilter();
$f->setCondition(new AndChainCondition(array(gte(f('EyeExamSchedule.date'), $date), isnull(f('EyeExamSchedule.eyeExamRequestID')))));
$f->setGrouping(f('EyeExamSchedule.date'));
$f->setLimit(self::ACTIVE_DATES_LIMIT);
$timeList = ActiveRecordModel::getRecordSetFields('EyeExamSchedule', $f, array('date'));
// as result is an array of arrays with single value
$activeTimes = array();
foreach ($timeList as $id) {
$activeTimes[] = $id['date'];
}
return $activeTimes;
}