How can I modify $this->request->data from model in CakePHP. I tried it with code in model User :
public function beforeValidate($options = array()) {
unset($this->request->data['User']['birthday']);
}
But it return errors :
Notice (8): Indirect modification of overloaded property User::$request has no effect
Warning (2): Attempt to modify property of non-object
If I use (model User) :
public function beforeValidate($options = array()) {
unset($this->data[$this->alias]['birthday']);
}
It's ok, but after validate, when I tried print_r($this->request->data) in controller, I see birthday field that still exists in it.
Anyone can give me a solution for this, is different between $this->data and $this->request->data, thanks !!
Edit : My CakePHP version is 2.6.7 - newest version.