public function renderDefault()
{
$articles = $this->articlesDao->fetch(new ArticlesQuery());
$articles->applyPaginator($this['vp']->paginator);
$this->template->articles = $articles;
}
protected function createComponentVp()
{
return new VisualPaginator;
}
.
It automatically counts the query, passes the count of results to paginator
and then reads the offset from paginator and applies it to the query so you get the correct results.
Datei anzeigen
Open project: kdyby/doctrine
Class Usage Examples
Method | Description | |
---|---|---|
__construct ( Doctrine\ORM\AbstractQuery $query, |
||
applyPaginator ( Nette\Utils\Paginator $paginator, integer $itemsPerPage = NULL ) : |
||
applyPaging ( integer $offset, integer $limit ) : |
||
applySorting ( string | array $columns ) : |
||
clearSorting ( ) : |
Removes ORDER BY clause that is not inside subquery. | |
count ( ) : integer | ||
getFetchJoinCollection ( ) : boolean | ||
getIterator ( integer $hydrationMode = ORM\AbstractQuery::HYDRATE_OBJECT ) : ArrayIterator | ||
getTotalCount ( ) : integer | ||
getUseOutputWalkers ( ) : boolean | null | ||
isEmpty ( ) : boolean | ||
setFetchJoinCollection ( boolean $fetchJoinCollection ) : |
||
setUseOutputWalkers ( boolean | null $useOutputWalkers ) : |
||
toArray ( integer $hydrationMode = ORM\AbstractQuery::HYDRATE_OBJECT ) : array |
Method | Description | |
---|---|---|
createPaginatedQuery ( Doctrine\ORM\Query $query ) : Doctrine\ORM\Tools\Pagination\Paginator | ||
updating ( ) |
public __construct ( Doctrine\ORM\AbstractQuery $query, |
||
$query | Doctrine\ORM\AbstractQuery | |
$queryObject | ||
$repository | Kdyby\Persistence\Queryable |
public applyPaginator ( Nette\Utils\Paginator $paginator, integer $itemsPerPage = NULL ) : |
||
$paginator | Nette\Utils\Paginator | |
$itemsPerPage | integer | |
return |
public applyPaging ( integer $offset, integer $limit ) : |
||
$offset | integer | |
$limit | integer | |
return |
public applySorting ( string | array $columns ) : |
||
$columns | string | array | |
return |
public clearSorting ( ) : |
||
return |
public getIterator ( integer $hydrationMode = ORM\AbstractQuery::HYDRATE_OBJECT ) : ArrayIterator | ||
$hydrationMode | integer | |
return | ArrayIterator |
public getUseOutputWalkers ( ) : boolean | null | ||
return | boolean | null |
public setFetchJoinCollection ( boolean $fetchJoinCollection ) : |
||
$fetchJoinCollection | boolean | |
return |
public setUseOutputWalkers ( boolean | null $useOutputWalkers ) : |
||
$useOutputWalkers | boolean | null | |
return |