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.
Afficher le fichier
Open project: kdyby/doctrine
Class Usage Examples
Méthode | 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 |
Méthode | 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 | |
Résultat |
public applyPaging ( integer $offset, integer $limit ) : |
||
$offset | integer | |
$limit | integer | |
Résultat |
public applySorting ( string | array $columns ) : |
||
$columns | string | array | |
Résultat |
public clearSorting ( ) : |
||
Résultat |
public getFetchJoinCollection ( ) : boolean | ||
Résultat | boolean |
public getIterator ( integer $hydrationMode = ORM\AbstractQuery::HYDRATE_OBJECT ) : ArrayIterator | ||
$hydrationMode | integer | |
Résultat | ArrayIterator |
public getUseOutputWalkers ( ) : boolean | null | ||
Résultat | boolean | null |
public setFetchJoinCollection ( boolean $fetchJoinCollection ) : |
||
$fetchJoinCollection | boolean | |
Résultat |
public setUseOutputWalkers ( boolean | null $useOutputWalkers ) : |
||
$useOutputWalkers | boolean | null | |
Résultat |