Commit 87d2cc6f authored by Ad Schellevis's avatar Ad Schellevis Committed by GitHub

Merge pull request #1150 from pv2b/improve-validation-exception

(BaseModel) Always log the class where validation failed
parents 5e127d5e 8f84e0a7
...@@ -469,9 +469,10 @@ abstract class BaseModel ...@@ -469,9 +469,10 @@ abstract class BaseModel
if ($messages->count() > 0) { if ($messages->count() > 0) {
$exception_msg = ""; $exception_msg = "";
foreach ($messages as $msg) { foreach ($messages as $msg) {
$exception_msg .= "[".$msg-> getField()."] ".$msg->getMessage()."\n"; $exception_msg_part = "[".str_replace("\\", ".", get_class($this)).".".$msg-> getField(). "] " .$msg->getMessage();
$exception_msg .= "$exception_msg_part\n";
// always log validation errors // always log validation errors
$logger->error(str_replace("\\", ".", get_class($this)).".".$msg-> getField(). " " .$msg->getMessage()); $logger->error($exception_msg_part);
} }
if (!$disable_validation) { if (!$disable_validation) {
throw new \Phalcon\Validation\Exception($exception_msg); throw new \Phalcon\Validation\Exception($exception_msg);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment