How to check in Controller which validation rule failed in cakePHP

H

How Can We Help?

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

About the author

Ian Carnaghan

I am a software developer and online educator who likes to keep up with all the latest in technology. I also manage cloud infrastructure, continuous monitoring, DevOps processes, security, and continuous integration and deployment.

About Author

Ian Carnaghan

I am a software developer and online educator who likes to keep up with all the latest in technology. I also manage cloud infrastructure, continuous monitoring, DevOps processes, security, and continuous integration and deployment.

Follow Me