本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例6: __construct
public function __construct($query, $fetchJoinCollection = false)
{
return parent::__construct($query, $fetchJoinCollection);
}
示例7: __construct
public function __construct($query, $queryIds = null, $fetchJoinCollection = true)
{
parent::__construct($query, $fetchJoinCollection);
$this->queryIds = $queryIds;
}
示例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');
}
示例9: __construct
/**
* @param QueryBuilder $builder
* @param Search $search
*/
public function __construct(QueryBuilder $builder, Search $search)
{
$this->builder = $builder;
$this->search = $search;
parent::__construct($builder);
}
示例10: __construct
public function __construct(Query $query, $currentPage = 1)
{
parent::__construct($query);
$this->currentPage = (int) $currentPage;
}