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


PHP QueryBuilder::getMaxResults方法代码示例

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


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

示例1: run

 /**
  * @param QueryBuilder $queryBuilder
  * @param $callback
  * @param int|null $limit
  * @param int $maxAttempts
  * @throws DBALWalkerException
  * @throws DBALException
  */
 public function run(QueryBuilder $queryBuilder, $callback, $limit = null, $maxAttempts = 10)
 {
     if (!is_callable($callback)) {
         throw new DBALWalkerException('$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 = [];
         $errors = $maxAttempts;
         while (true) {
             try {
                 $rows = $queryBuilder->setFirstResult($offset)->execute()->fetchAll();
                 break;
             } catch (DBALException $e) {
                 if ($errors-- == 0) {
                     throw $e;
                 }
                 $queryBuilder->getConnection()->connect();
             }
         }
         call_user_func($callback, $rows, $offset, $limit);
         $offset += $limit;
     } while (count($rows) >= $limit);
 }
开发者ID:octava,项目名称:replication,代码行数:40,代码来源:Walker.php

示例2: getMaxResultsDelegatesToConcreteQueryBuilder

 /**
  * @test
  */
 public function getMaxResultsDelegatesToConcreteQueryBuilder()
 {
     $this->concreteQueryBuilder->getMaxResults()->shouldBeCalled()->willReturn(1);
     $this->subject->getMaxResults();
 }
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:8,代码来源:QueryBuilderTest.php

示例3: testSetMaxResults

 public function testSetMaxResults()
 {
     $qb = new QueryBuilder($this->conn);
     $qb->setMaxResults(10);
     $this->assertEquals(QueryBuilder::STATE_DIRTY, $qb->getState());
     $this->assertEQuals(10, $qb->getMaxResults());
 }
开发者ID:robertowest,项目名称:CuteFlow-V4,代码行数:7,代码来源:QueryBuilderTest.php

示例4: getMaxResults

 /**
  * Gets the maximum number of results the query object was set to retrieve (the "limit").
  * Returns NULL if {@link setMaxResults} was not applied to this query builder.
  *
  * @return integer The maximum number of results.
  */
 public function getMaxResults()
 {
     return $this->queryBuilder->getMaxResults();
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:10,代码来源:QueryBuilder.php

示例5: getMaxResults

 /**
  * Gets the maximum number of results the query object was set to retrieve (the "limit").
  * Returns NULL if {@link setMaxResults} was not applied to this query builder.
  *
  * @return integer The maximum number of results.
  */
 public function getMaxResults()
 {
     return $this->qb->getMaxResults();
 }
开发者ID:Maksold,项目名称:platform,代码行数:10,代码来源:SqlQueryBuilder.php


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