Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Commit

Permalink
If knp_pager doesn't have paginator dependency injected, throw an exc…
Browse files Browse the repository at this point in the history
…eption.
  • Loading branch information
stephpy committed Aug 25, 2014
1 parent 87c642b commit a634c4f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Spy/Timeline/ResultBuilder/Pager/KnpPager.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ public function __construct(Paginator $paginator = null)
*/
public function paginate($target, $page = 1, $limit = 10)
{
if (null === $this->paginator) {
throw new \LogicException(sprintf('Knp\Component\Pager\Paginator not injected in constructor of %s', __CLASS__));
}

$this->page = $page;
$this->pager = $this->paginator->paginate($target, $page, $limit);
$this->data = $this->pager->getPaginationData();
Expand Down

0 comments on commit a634c4f

Please sign in to comment.