From 4130db2ce73fbeabf187d74756fcf42ebfcf6ce3 Mon Sep 17 00:00:00 2001 From: superchlastac <108008045+superchlastac@users.noreply.github.com> Date: Thu, 4 Aug 2022 14:42:21 +0200 Subject: [PATCH 1/4] Update ResultSet.php --- src/ResultSet.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ResultSet.php b/src/ResultSet.php index de38209..1be7c3e 100644 --- a/src/ResultSet.php +++ b/src/ResultSet.php @@ -44,6 +44,11 @@ public function getPaginator(): Paginator $paginator->setPage($this->page); $paginator->setItemsPerPage($this->itemsPerPage); + if ($paginator->getPage() !== $this->page) + { + throw new PageIsOutOfRangeException('Page number is out of range. Page number '.$this->page . ' is not in the range ('.$paginator->getFirstPage().', '.$paginator->getLastPage().')'); + } + return $this->paginator = $paginator; } From 47104b958058fe36b2641031cb19ee62dfc92449 Mon Sep 17 00:00:00 2001 From: superchlastac <108008045+superchlastac@users.noreply.github.com> Date: Thu, 4 Aug 2022 14:42:55 +0200 Subject: [PATCH 2/4] Create exceptions.php --- src/exceptions.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/exceptions.php diff --git a/src/exceptions.php b/src/exceptions.php new file mode 100644 index 0000000..057fbeb --- /dev/null +++ b/src/exceptions.php @@ -0,0 +1,13 @@ + Date: Thu, 4 Aug 2022 15:10:54 +0200 Subject: [PATCH 3/4] Update and rename exceptions.php to PageIsOutOfRangeException.php --- src/PageIsOutOfRangeException.php | 8 ++++++++ src/exceptions.php | 13 ------------- 2 files changed, 8 insertions(+), 13 deletions(-) create mode 100644 src/PageIsOutOfRangeException.php delete mode 100644 src/exceptions.php diff --git a/src/PageIsOutOfRangeException.php b/src/PageIsOutOfRangeException.php new file mode 100644 index 0000000..a5b0b0a --- /dev/null +++ b/src/PageIsOutOfRangeException.php @@ -0,0 +1,8 @@ + Date: Thu, 4 Aug 2022 15:15:03 +0200 Subject: [PATCH 4/4] Update PageIsOutOfRangeException.php --- src/PageIsOutOfRangeException.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PageIsOutOfRangeException.php b/src/PageIsOutOfRangeException.php index a5b0b0a..d71b7f8 100644 --- a/src/PageIsOutOfRangeException.php +++ b/src/PageIsOutOfRangeException.php @@ -2,7 +2,7 @@ namespace ADT\DoctrineComponents; -class PageIsOutOfRangeException extends \OutOfRangeException +class PageIsOutOfRangeException extends \Exception { }