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


in app, define (among other things) locale based on user's preference stored in cookie if any, or using browser's settings. of done in appcontroller::beforefilter().

problem: 404 errors thrown missing route exception, request doesn't event reach controller. error400.ctp template not rendered correct locale.

so defining locale in appcontroller::beforefilter may not best practice. idea should this?

i put logic in dispatcherfilter:

http://book.cakephp.org/3.0/en/development/dispatch-filters.html

you can take @ 1 inspiration:

https://github.com/cakephp/cakephp/blob/master/src/routing/filter/localeselectorfilter.php


Popular posts from this blog