當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。