cakephpcakephp-2.4

CakePHP v2.4.3 record update and validation rules


I'm trying to update one record with

$this->Model->id = 1;
$this->Model->save($this->request->data);

and to use validation rule 'on'=>'update'.

Is that possible and how :) ?


Solution

  • Solution to my problem was to remove validation rule for the field that i don't want to validate when i update record.

     $this->Model->validator()->remove('fieldName');
     $this->Model->id = 1;
     $this->Model->save($this->request->data);