当前位置: 首页>>代码示例>>PHP>>正文


PHP PaginatedList::getList方法代码示例

本文整理汇总了PHP中PaginatedList::getList方法的典型用法代码示例。如果您正苦于以下问题:PHP PaginatedList::getList方法的具体用法?PHP PaginatedList::getList怎么用?PHP PaginatedList::getList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PaginatedList的用法示例。


在下文中一共展示了PaginatedList::getList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: buildAllAttributeFacets

 /**
  * Builds facets from all attributes present in the data set.
  * @param DataList|PaginatedList $matches
  * @return array
  */
 protected function buildAllAttributeFacets($matches)
 {
     $q = $matches instanceof PaginatedList ? $matches->getList()->dataQuery()->query() : $matches->dataQuery()->query();
     // this is the easiest way to get SiteTree vs SiteTree_Live
     $baseTable = $q->getFrom();
     if (is_array($baseTable)) {
         $baseTable = reset($baseTable);
     }
     $q = $q->setSelect(array())->selectField('"ProductAttributeType"."ID"', 'TypeID')->selectField('"ProductAttributeType"."Label"', 'TypeLabel')->selectField('"ProductAttributeValue"."ID"', 'Value')->selectField('"ProductAttributeValue"."Value"', 'Label')->selectField('count(distinct ' . $baseTable . '."ID")', 'Count')->selectField('"ProductAttributeValue"."Sort"')->addInnerJoin('Product_StaticAttributeTypes', $baseTable . '."ID" = "Product_StaticAttributeTypes"."ProductID"')->addInnerJoin('ProductAttributeType', '"Product_StaticAttributeTypes"."ProductAttributeTypeID" = "ProductAttributeType"."ID"')->addInnerJoin('Product_StaticAttributeValues', $baseTable . '."ID" = "Product_StaticAttributeValues"."ProductID"')->addInnerJoin('ProductAttributeValue', '"Product_StaticAttributeValues"."ProductAttributeValueID" = "ProductAttributeValue"."ID"' . ' AND "ProductAttributeValue"."TypeID" = "ProductAttributeType"."ID"')->setOrderBy(array('"ProductAttributeType"."Label"' => 'ASC', '"ProductAttributeValue"."Sort"' => 'ASC'))->setGroupBy(array('"ProductAttributeValue"."ID"', '"ProductAttributeType"."ID"'))->execute();
     $curType = 0;
     $facets = array();
     $curFacet = null;
     foreach ($q as $row) {
         if ($curType != $row['TypeID']) {
             if ($curType > 0) {
                 $facets['ATT' . $curType] = $curFacet;
             }
             $curType = $row['TypeID'];
             $curFacet = array('Label' => $row['TypeLabel'], 'Source' => 'ATT' . $curType, 'Type' => ShopSearch::FACET_TYPE_LINK, 'Values' => array());
         }
         unset($row['TypeID']);
         unset($row['TypeLabel']);
         $curFacet['Values'][$row['Value']] = new ArrayData($row);
     }
     if ($curType > 0) {
         $facets['ATT' . $curType] = $curFacet;
     }
     return $facets;
 }
开发者ID:helpfulrobot,项目名称:markguinn-silverstripe-shop-search,代码行数:34,代码来源:FacetHelper.php


注:本文中的PaginatedList::getList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。