Skip to content

Commit

Permalink
Allow pager creation with custom adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
stefk committed Apr 16, 2015
1 parent ceed433 commit 54489f8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Pager/PagerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ public function createPager(Query $query, $currentPage, $max = 20)
{
$adapter = new DoctrineORMAdapter($query);

return $this->createPagerfanta($adapter, $currentPage, $max);
return $this->createPagerWithAdapter($adapter, $currentPage, $max);
}

public function createPagerFromArray(array $datas, $currentPage, $max = 20)
{
$adapter = new ArrayAdapter($datas);

return $this->createPagerfanta($adapter, $currentPage, $max);
return $this->createPagerWithAdapter($adapter, $currentPage, $max);
}

private function createPagerfanta(AdapterInterface $adapter, $currentPage, $max = 20)
public function createPagerWithAdapter(AdapterInterface $adapter, $currentPage, $max = 20)
{
$pager = new Pagerfanta($adapter);
$pager->setMaxPerPage($max); // should be configurable
Expand Down

0 comments on commit 54489f8

Please sign in to comment.