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


PHP QueryBuilder::getMaxResults方法代码示例

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


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

示例1: testCreateDataSet_pagination

 public function testCreateDataSet_pagination()
 {
     $request = $this->getBaseRequest();
     $request->displayStart = 100;
     $request->displayLength = 10;
     $dataSet = $this->dataSource->createDataSet($request);
     $this->assertEquals(100, $this->qb->getFirstResult());
     $this->assertEquals(10, $this->qb->getMaxResults());
 }
开发者ID:deft,项目名称:datatables-php,代码行数:9,代码来源:QueryBuilderDataSourceTest.php

示例2: getData

 /**
  * It is possible to use query builder with additional columns.
  * In this case, only item at index [0] is returned, because
  * it should be an entity object.
  * @return array
  */
 public function getData()
 {
     $data = array();
     // Paginator is better if the query uses ManyToMany associations
     $result = $this->qb->getMaxResults() !== NULL || $this->qb->getFirstResult() !== NULL ? new Paginator($this->getQuery()) : $this->qb->getQuery()->getResult();
     foreach ($result as $item) {
         // Return only entity itself
         $data[] = is_array($item) ? $item[0] : $item;
     }
     return $data;
 }
开发者ID:s4muel,项目名称:grido,代码行数:17,代码来源:Doctrine.php

示例3: run

 public function run(QueryBuilder $queryBuilder, $callback, $limit = null)
 {
     if (!is_callable($callback)) {
         throw new ORMWalkerException('$callback is not callable');
     }
     if (!is_null($limit)) {
         $queryBuilder->setMaxResults($limit);
     } else {
         $limit = $queryBuilder->getMaxResults();
     }
     if (is_null($limit)) {
         $limit = PHP_INT_MAX;
     }
     $offset = 0;
     do {
         $rows = $queryBuilder->setFirstResult($offset)->getQuery()->getResult();
         call_user_func($callback, $rows, $offset, $limit);
         $offset += $limit;
     } while (count($rows) >= $limit);
 }
开发者ID:octava,项目名称:replication,代码行数:20,代码来源:Walker.php

示例4: getData

 /**
  * It is possible to use query builder with additional columns.
  * In this case, only item at index [0] is returned, because
  * it should be an entity object.
  * @return array
  */
 public function getData()
 {
     // Paginator is better if the query uses ManyToMany associations
     $usePaginator = $this->qb->getMaxResults() !== NULL || $this->qb->getFirstResult() !== NULL;
     $data = array();
     if ($usePaginator) {
         $paginator = new Paginator($this->getQuery());
         // Convert paginator to the array
         foreach ($paginator as $result) {
             // Return only entity itself
             $data[] = is_array($result) ? $result[0] : $result;
         }
     } else {
         foreach ($this->qb->getQuery()->getResult() as $result) {
             // Return only entity itself
             $data[] = is_array($result) ? $result[0] : $result;
         }
     }
     return $data;
 }
开发者ID:cujan,项目名称:vcelyweb,代码行数:26,代码来源:Doctrine.php

示例5: hasMaxResults

 /**
  * Determines whether the query builder has the maximum number of results specified.
  *
  * @param QueryBuilder $queryBuilder
  *
  * @return bool
  */
 public static function hasMaxResults(QueryBuilder $queryBuilder)
 {
     return null !== $queryBuilder->getMaxResults();
 }
开发者ID:akomm,项目名称:DunglasApiBundle,代码行数:11,代码来源:QueryChecker.php

示例6: countPages

 /**
  * @return int
  */
 public function countPages()
 {
     return (int) ceil($this->count() / $this->builder->getMaxResults());
 }
开发者ID:thomasage,项目名称:asso,代码行数:7,代码来源:SearchResult.php

示例7: getMaxResults

 /**
  * {@inheritdoc}
  */
 public function getMaxResults()
 {
     return $this->queryBuilder->getMaxResults();
 }
开发者ID:paolotremadio,项目名称:SonataDoctrineORMAdminBundle,代码行数:7,代码来源:ProxyQuery.php


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