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


PHP Paginator::__construct方法代码示例

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


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

示例1: __construct

 public function __construct(QueryBuilder $query, $fetchJoinCollection = true)
 {
     $countQuery = clone $query;
     $countQuery = $countQuery->select('count(e) as c')->setFirstResult(0)->setMaxResults(1)->getQuery();
     $this->countQuery = $countQuery;
     parent::__construct($query, $fetchJoinCollection);
 }
开发者ID:lafaiDev,项目名称:suive_com,代码行数:7,代码来源:Paginator.php

示例2: __construct

 public function __construct(QueryBuilder $qb, $limit, $page = 1)
 {
     $offset = ($page - 1) * $limit;
     $qb->setFirstResult($offset)->setMaxResults($limit);
     $this->page = $page;
     $this->limit = $limit;
     parent::__construct($qb);
 }
开发者ID:morki,项目名称:bounce-bundle,代码行数:8,代码来源:Paginator.php

示例3: __construct

 /**
  * __construct
  *
  * @param Dql  $dql
  * @param integer $page
  * @param integer $limit
  */
 public function __construct($dql, $page = 1, $limit = 15)
 {
     parent::__construct($dql);
     $this->setPageAndLimit($page, $limit);
     //Set limit
     $this->getQuery()->setFirstResult($this->limit * ($this->page - 1))->setMaxResults($this->limit);
     //Calculate
     $this->totalRecordReturned = $this->getIterator()->count();
     $this->totalRecord = $this->count();
     $this->maxPage = ceil($this->totalRecord / $this->limit);
 }
开发者ID:tnqsoft,项目名称:common-bundle,代码行数:18,代码来源:PaginatorService.php

示例4: __construct

 public function __construct(\Doctrine\ORM\AbstractQuery $query, $currentPage, $pageSize, $showNumbers = 5, $fetchJoinCollection = true)
 {
     parent::__construct($query, $fetchJoinCollection);
     $query->setFirstResult($pageSize * ($currentPage - 1))->setMaxResults($pageSize);
     // set the limit;
     $this->pageSize = $pageSize;
     $this->totalItems = count($this);
     $this->totalPage = ceil($this->totalItems / $query->getMaxResults());
     $this->currentPage = max(1, min($this->totalPage, $currentPage));
     $this->firstPage = 1 + intval(($this->currentPage - 1) / $showNumbers) * $showNumbers;
     $this->lastPage = min($this->firstPage + $showNumbers - 1, $this->totalPage);
 }
开发者ID:sunceenjoy,项目名称:remember_english_words,代码行数:12,代码来源:Paginator.php

示例5: __construct

 /**
  * Constructor.
  *
  * @param Query|QueryBuilder $query
  *        	A Doctrine ORM query or query builder.
  * @param boolean $fetchJoinCollection
  *        	Whether the query joins a collection (true by default).
  * @param boolean $cache
  *        	Use result cache (true by default).
  * @param boolean $count
  *        	Execute count query (true by default).
  */
 public function __construct($query, $fetchJoinCollection = true, $cached = true, $count = true)
 {
     if ($count) {
         $countQuery = clone $query;
         $countQuery = $countQuery->select('count(e) as c')->setFirstResult(0)->setMaxResults(1)->getQuery();
         $this->countQuery = $countQuery;
     }
     $q = $query;
     if ($cached) {
         $this->cache_prefix = '';
         if ($query instanceof QueryBuilder) {
             $q = $query->getQuery();
             $entities = $query->getRootEntities();
             if ($entities) {
                 $entity = $entities[0];
                 $this->cache_prefix = strtolower(substr(strrchr($entity, '\\'), 1) ?: $entity) . '-';
             }
         }
         $q->useQueryCache(true)->useResultCache(true, 3600, $this->cache_prefix . md5($q->getDQL()));
     }
     parent::__construct($q, $fetchJoinCollection);
 }
开发者ID:arstropica,项目名称:zf2-dashboard,代码行数:34,代码来源:Paginator.php

示例6: __construct

 public function __construct($query, $fetchJoinCollection = false)
 {
     return parent::__construct($query, $fetchJoinCollection);
 }
开发者ID:arnaud-hours,项目名称:PlaygroundCore,代码行数:4,代码来源:LargeTablePaginator.php

示例7: __construct

 public function __construct($query, $queryIds = null, $fetchJoinCollection = true)
 {
     parent::__construct($query, $fetchJoinCollection);
     $this->queryIds = $queryIds;
 }
开发者ID:cgtechnosoft2013,项目名称:smart-utils,代码行数:5,代码来源:Paginator.php

示例8: __construct

 /**
  * Constructor.
  *
  * @param Query|QueryBuilder $query A Doctrine ORM query or query builder.
  * @param Boolean $fetchJoinCollection Whether the query joins a collection (true by default).
  */
 public function __construct($query, $fetchJoinCollection = true)
 {
     parent::__construct($query, $fetchJoinCollection);
     // We have to use the SQL Server query walker to get the correct wrapping.
     $this->getQuery()->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, 'DoctrineSqlServerExtensions\\ORM\\Query\\AST\\SQLServerSqlWalker');
 }
开发者ID:brainsonic,项目名称:DoctrineSqlServerExtensions,代码行数:12,代码来源:Paginator.php

示例9: __construct

 /**
  * @param QueryBuilder $builder
  * @param Search $search
  */
 public function __construct(QueryBuilder $builder, Search $search)
 {
     $this->builder = $builder;
     $this->search = $search;
     parent::__construct($builder);
 }
开发者ID:thomasage,项目名称:asso,代码行数:10,代码来源:SearchResult.php

示例10: __construct

 public function __construct(Query $query, $currentPage = 1)
 {
     parent::__construct($query);
     $this->currentPage = (int) $currentPage;
 }
开发者ID:jirro,项目名称:jirro,代码行数:5,代码来源:Paginator.php


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