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


PHP QueryBuilder::groupBy方法代码示例

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


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

示例1: getDataQuery

 /**
  * Build the data query
  *
  * @return QueryBuilder
  */
 public function getDataQuery()
 {
     $this->buildFilteredQuery();
     if ($this->offset !== null) {
         $this->currentQueryBuilder->setFirstResult($this->offset);
     }
     if ($this->length !== null) {
         $this->currentQueryBuilder->setMaxResults($this->length);
     }
     if ($this->orders !== null) {
         foreach ($this->orders as $order) {
             list($column, $dir) = $order;
             $this->currentQueryBuilder->addOrderBy($column->sourceSort, $dir);
         }
     }
     if (isset($this->conf->group)) {
         $this->currentQueryBuilder->groupBy($this->conf->group);
     }
     return $this->currentQueryBuilder;
 }
开发者ID:solire,项目名称:trieur,代码行数:25,代码来源:Doctrine.php

示例2: groupByQuotesIdentifierAndDelegatesToConcreteQueryBuilder

 /**
  * @test
  */
 public function groupByQuotesIdentifierAndDelegatesToConcreteQueryBuilder()
 {
     $this->connection->quoteIdentifiers(['aField', 'anotherField'])->shouldBeCalled()->willReturnArgument(0);
     $this->concreteQueryBuilder->groupBy('aField', 'anotherField')->shouldBeCalled()->willReturn($this->subject);
     $this->subject->groupBy('aField', 'anotherField');
 }
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:9,代码来源:QueryBuilderTest.php

示例3: finalizeQuery

 public function finalizeQuery(\Doctrine\DBAL\Query\QueryBuilder $query)
 {
     $paramcount = 0;
     if (!empty($this->gIDs)) {
         $validgids = array();
         foreach ($this->gIDs as $gID) {
             if ($gID > 0) {
                 $validgids[] = $gID;
             }
         }
         if (!empty($validgids)) {
             $query->innerJoin('p', 'VividStoreProductGroups', 'g', 'p.pID = g.pID and g.gID in (' . implode(',', $validgids) . ')');
             if (!$this->groupMatchAny) {
                 $query->having('count(g.gID) = ' . count($validgids));
             }
         }
     }
     switch ($this->sortBy) {
         case "alpha":
             $query->orderBy('pName', 'ASC');
             break;
         case "date":
             $query->orderBy('pDateAdded', 'DESC');
             break;
     }
     switch ($this->featured) {
         case "featured":
             $query->andWhere("pFeatured = 1");
             break;
         case "nonfeatured":
             $query->andWhere("pFeatured = 0");
             break;
     }
     if ($this->activeOnly) {
         $query->andWhere("pActive = 1");
     }
     if (is_array($this->cIDs) && !empty($this->cIDs)) {
         $query->innerJoin('p', 'VividStoreProductLocations', 'l', 'p.pID = l.pID and l.cID in (' . implode(',', $this->cIDs) . ')');
     }
     $query->groupBy('p.pID');
     if ($this->search) {
         $query->andWhere('pName like ?')->setParameter($paramcount++, '%' . $this->search . '%');
     }
     return $query;
 }
开发者ID:Janoinen,项目名称:vivid_store,代码行数:45,代码来源:ProductList.php

示例4: groupBy

 public function groupBy($groupBy)
 {
     $connection = $this->getConnection();
     return parent::groupBy($connection->quoteIdentifier($groupBy));
 }
开发者ID:GruppoMeta,项目名称:Movio,代码行数:5,代码来源:QueryBuilder.php

示例5: groupBy

 /**
  * Specifies a grouping over the results of the query.
  * Replaces any previously specified groupings, if any.
  *
  * @param mixed $groupBy The grouping expression.
  *
  * @return self
  */
 public function groupBy($groupBy)
 {
     $this->qb->groupBy($groupBy);
     return $this;
 }
开发者ID:Maksold,项目名称:platform,代码行数:13,代码来源:SqlQueryBuilder.php

示例6: finalizeQuery

 public function finalizeQuery(\Doctrine\DBAL\Query\QueryBuilder $query)
 {
     $paramcount = 0;
     if (!empty($this->gIDs)) {
         $validgids = array();
         foreach ($this->gIDs as $gID) {
             if ($gID > 0) {
                 $validgids[] = $gID;
             }
         }
         if (!empty($validgids)) {
             $query->innerJoin('p', 'VividStoreProductGroups', 'g', 'p.pID = g.pID and g.gID in (' . implode(',', $validgids) . ')');
             if (!$this->groupMatchAny) {
                 $query->having('count(g.gID) = ' . count($validgids));
             }
         }
     }
     switch ($this->sortBy) {
         case "alpha":
             $query->orderBy('pName', 'ASC');
             break;
         case "date":
             $query->orderBy('pDateAdded', 'DESC');
             break;
         case "pricelth":
             $query->orderBy('pPrice', 'ASC');
             break;
         case "pricehtl":
             $query->orderBy('pPrice', 'DESC');
             break;
         case "popular":
             $pr = new StoreProductReport();
             $pr->sortByPopularity();
             $products = $pr->getProducts();
             $pIDs = array();
             foreach ($products as $product) {
                 $pIDs[] = $product['pID'];
             }
             foreach ($pIDs as $pID) {
                 $query->addOrderBy("pID = ?", 'DESC')->setParameter($paramcount++, $pID);
             }
             break;
     }
     switch ($this->featured) {
         case "featured":
             $query->andWhere("pFeatured = 1");
             break;
         case "nonfeatured":
             $query->andWhere("pFeatured = 0");
             break;
     }
     if (!$this->showOutOfStock) {
         $query->andWhere("pQty > 0 OR pQtyUnlim = 1");
     }
     if ($this->activeOnly) {
         $query->andWhere("pActive = 1");
     }
     if (is_array($this->cIDs) && !empty($this->cIDs)) {
         $query->innerJoin('p', 'VividStoreProductLocations', 'l', 'p.pID = l.pID and l.cID in (' . implode(',', $this->cIDs) . ')');
     }
     $query->groupBy('p.pID');
     if ($this->search) {
         $query->andWhere('pName like ?')->setParameter($paramcount++, '%' . $this->search . '%');
     }
     return $query;
 }
开发者ID:vividweb,项目名称:vivid_store,代码行数:66,代码来源:ProductList.php

示例7: applySearchQueryRelationship

 /**
  * @param QueryBuilder $q
  * @param array        $tables          $tables[0] should be primary table
  * @param bool         $innerJoinTables
  * @param null         $whereExpression
  * @param null         $having
  */
 protected function applySearchQueryRelationship(QueryBuilder $q, array $tables, $innerJoinTables, $whereExpression = null, $having = null)
 {
     $primaryTable = $tables[0];
     unset($tables[0]);
     $joinType = $innerJoinTables ? 'join' : 'leftJoin';
     $this->useDistinctCount = true;
     $joins = $q->getQueryPart('join');
     if (!array_key_exists($primaryTable['alias'], $joins)) {
         $q->{$joinType}($primaryTable['from_alias'], MAUTIC_TABLE_PREFIX . $primaryTable['table'], $primaryTable['alias'], $primaryTable['condition']);
         foreach ($tables as $table) {
             $q->{$joinType}($table['from_alias'], MAUTIC_TABLE_PREFIX . $table['table'], $table['alias'], $table['condition']);
         }
         if ($whereExpression) {
             $q->andWhere($whereExpression);
         }
         if ($having) {
             $q->andHaving($having);
         }
         $q->groupBy('l.id');
     }
 }
开发者ID:dongilbert,项目名称:mautic,代码行数:28,代码来源:LeadRepository.php


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