CakePHP 4.4 – PaginatorComponent is Deprecated

Written by James McDonald

August 3, 2022

I got this deprecation warning after upgrading to CakePHP 4.4

"PaginatorComponent is deprecated, use a Cake\Datasource\Pagination\NumericPaginator instance directly"

I thought that meant I had to run the CakePHP 4 upgrade tool and it would fix it but no.

Simple Fix

Remove this line from your Controllers

$this->loadComponent('Paginator'); // remove this line from all your code

Running the Upgrade Tool is Good Idea

I did run the upgrade tool and the cakephp43 rector rules did some nice changes. For example using the cakephp43 rules got rid of getTableLocator() and replaced it with fetchTable()

Check each new Version’s Migration Guide

Be sure to check the migration guide for each version you upgrade to: https://book.cakephp.org/4/en/appendices/4-4-migration-guide.html

Installing and Using the CakePHP 4 Upgrade Tool

https://book.cakephp.org/4/en/appendices/4-0-upgrade-guide.html#upgrade-tool-use

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.

You May Also Like…

List local disks

GET-CimInstance -query "SELECT * from Win32_DiskDrive" DeviceID Caption Partitions Size Model -------- -------...

Create ISO using Powershell

Usage New-IsoFile -NewIsoFilePath C:\tmp\Hyper-V.iso-sources -ImageName Hyper-V -SourceFilePath 'C:\tmp\Hyper-V'...