How to check in Controller which validation rule failed in cakePHP

Put the code below in your controller and replace the model name with the appropriate model name against which to check.

$errors = $this->ModelName->invalidFields();

The above code will return a array containing the validation rules that failed.

To read more about validating data in cakePHP click here

Image Credits: Photo by Isis França on Unsplash.

More Similar Posts

No results found.