From cbb737e18ecce07821652e890743b97e5bb63ecf Mon Sep 17 00:00:00 2001 From: iglocska <andras.iklody@gmail.com> Date: Wed, 17 Aug 2022 14:00:38 +0200 Subject: [PATCH] fix: [deprecation] pagination component's use removed to comply with 4.4 requirements --- src/Controller/AlignmentsController.php | 3 +-- src/Controller/Component/CRUDComponent.php | 3 +-- src/Controller/Component/CustomPaginationComponent.php | 1 + 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Controller/AlignmentsController.php b/src/Controller/AlignmentsController.php index a8dd626..a264fb1 100644 --- a/src/Controller/AlignmentsController.php +++ b/src/Controller/AlignmentsController.php @@ -23,8 +23,7 @@ class AlignmentsController extends AppController $alignments = $query->all(); return $this->RestResponse->viewData($alignments, 'json'); } else { - $this->loadComponent('Paginator'); - $alignments = $this->Paginator->paginate($query); + $alignments = $this->paginate($query); $this->set('data', $alignments); $this->set('metaGroup', 'ContactDB'); } diff --git a/src/Controller/Component/CRUDComponent.php b/src/Controller/Component/CRUDComponent.php index 5de6000..353d75f 100644 --- a/src/Controller/Component/CRUDComponent.php +++ b/src/Controller/Component/CRUDComponent.php @@ -100,8 +100,7 @@ class CRUDComponent extends Component if ($this->metaFieldsSupported()) { $query = $this->includeRequestedMetaFields($query); } - $this->Controller->loadComponent('Paginator'); - $data = $this->Controller->Paginator->paginate($query, $this->Controller->paginate ?? []); + $data = $this->Controller->paginate($query, $this->Controller->paginate ?? []); if (isset($options['afterFind'])) { $function = $options['afterFind']; if (is_callable($function)) { diff --git a/src/Controller/Component/CustomPaginationComponent.php b/src/Controller/Component/CustomPaginationComponent.php index 0f8871a..fe6869a 100644 --- a/src/Controller/Component/CustomPaginationComponent.php +++ b/src/Controller/Component/CustomPaginationComponent.php @@ -7,6 +7,7 @@ use Cake\Controller\ComponentRegistry; use Cake\Http\Exception\NotFoundException; use InvalidArgumentException; use Cake\Controller\Component\PaginatorComponent; +use Cake\Datasource\Pagination\NumericPaginator; use Cake\Utility\Hash; class CustomPaginationComponent extends Component