PGBI
PGBI

Reputation: 710

Cakephp 3.0 - executing AppController::beforeFilter() in case of MissingRouteException

In my app, I define (among other things) the locale based on user's preference stored in cookie if any, or by using his browser's settings. All of this is done in AppController::beforeFilter().

Problem: for 404 errors thrown by a missing route exception, the request doesn't event reach the controller. So my error400.ctp template is not rendered with the correct locale.

So defining the locale in AppController::beforeFilter may not be the best practice. Any idea where I should do this?

Upvotes: 1

Views: 1011

Answers (1)

Related Questions