From: Andrey Kutejko Date: Fri, 10 May 2013 10:08:11 +0000 (+0300) Subject: more verbose ORM validation error message X-Git-Tag: 0.5~276 X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;h=203efa59e671b02deb6f5de6c504a5423175090a;p=ipf.git more verbose ORM validation error message --- diff --git a/ipf/orm/exception/validator.php b/ipf/orm/exception/validator.php index 9d1b5de..6d4b56e 100644 --- a/ipf/orm/exception/validator.php +++ b/ipf/orm/exception/validator.php @@ -35,7 +35,10 @@ class IPF_ORM_Exception_Validator extends IPF_ORM_Exception implements Countable { $message = ""; foreach ($this->invalid as $record) { - $message .= "Validaton error in class " . get_class($record) . " "; + $errors = array(); + foreach ($record->getErrorStack() as $field => $validators) + $errors[] = 'Field "' . $field . '" failed following validators: ' . implode(', ', $validators) . '.'; + $message .= "Validaton error in class " . get_class($record) . ' (' . implode(' ', $errors) . ') '; } return $message; } @@ -46,4 +49,4 @@ class IPF_ORM_Exception_Validator extends IPF_ORM_Exception implements Countable call_user_func($function, $record->getErrorStack()); } } -} \ No newline at end of file +}