From 203efa59e671b02deb6f5de6c504a5423175090a Mon Sep 17 00:00:00 2001 From: Andrey Kutejko Date: Fri, 10 May 2013 13:08:11 +0300 Subject: [PATCH] more verbose ORM validation error message --- ipf/orm/exception/validator.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 +} -- 2.49.0