Last active
October 19, 2015 14:42
-
-
Save hmic/f5ef1cb41b6e99932941 to your computer and use it in GitHub Desktop.
soft fail paginate (Cakephp 3)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use App\Controller; | |
class CompaniesController extends AppController { | |
public function index() { | |
try { | |
$this->set('companies', $this->paginate($this->Companies->find())); | |
} catch(\Cake\Network\Exception\NotFoundException $e) { | |
return $this->redirect(['page' => 1] + $this->request->query); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment