I have two different methods in a controller for adding request data. I defined the validation in the model . But I want to use different validation rules in those methods.
Make a custom validation method in your table like validationCustom(Validator $validator)
and then when calling save()
specify option 'validate' => 'custom'
. You can find details in manual http://book.cakephp.org/3.0/en/core-libraries/validation.html#custom-validation-rules
1 Like