{"id":5340,"date":"2018-03-22T15:41:54","date_gmt":"2018-03-22T20:41:54","guid":{"rendered":"http:\/\/www.carnaghan.com\/?post_type=epkb_post_type_1&p=5340"},"modified":"2018-03-22T15:41:54","modified_gmt":"2018-03-22T20:41:54","slug":"how-to-check-in-controller-which-validation-rule-failed-in-cakephp","status":"publish","type":"epkb_post_type_1","link":"https:\/\/www.carnaghan.com\/knowledge-base\/how-to-check-in-controller-which-validation-rule-failed-in-cakephp\/","title":{"rendered":"How to check in Controller which validation rule failed in cakePHP"},"content":{"rendered":"
Put the code below in your controller and replace the model name with the appropriate model name against which to check.<\/p>\n
$errors = $this->ModelName->invalidFields();<\/pre>\n<\/div>\n<\/div>\nThe above code will return a array containing the validation rules that failed.<\/p>\n
To read more about\u00a0validating<\/strong>\u00a0data in\u00a0cakePHP<\/strong>\u00a0click\u00a0here<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"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\u00a0validating\u00a0data in\u00a0cakePHP\u00a0click\u00a0here<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"epkb_post_type_1_category":[4628],"epkb_post_type_1_tag":[],"yoast_head":"\n
How to check in Controller which validation rule failed in cakePHP - Ian Carnaghan<\/title>\n\n\n\n\n\n\n\n\n\n\n