How to check in Controller which validation rule failed in cakePHP

No Comments

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.

Last Updated On March 22, 2018

Related Articles

No results found

Leave a Reply

avatar
  Subscribe  
Notify of
Menu
Copy link