cakephp $this->params not set in beforeFilter
I needed to do something with $this->params in the AppController::beforeFilter()
I get Notice (8): Undefined variable: a
but when I set it in beforeFilter()
the b
variable is set normally. Is this normal behavior? And if it isn't, how do I get the params to be set in beforeFilter()
? It would have been better if I could work with the params before any action is called.
function beforeFilter() {
$this-开发者_JS百科>set('a', $this->params);
}
function beforeRender() {
$this->set('b', $this->params);
}
My bad, I had overriden beforeFilter
in an controller and forgot to call parent::beforeFilter()
at the start. Now it's ok.
精彩评论