Question : cakephp Not Found error handle in pagination
Answered by : alimon-pito
use Cake\Http\Exception\NotFoundException;
public function index()
{ try { $this->paginate(); } catch (NotFoundException $e) { // Do something here like redirecting to first or last page. // $this->request->getAttribute('paging') will give you required info. }
}
Source : https://book.cakephp.org/4/en/controllers/components/pagination.html | Last Update : Mon, 04 Jul 22