Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
gte451f committed Sep 7, 2017
2 parents f2cd9a0 + b89d958 commit aaf51f7
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/Result/Adapters/ActiveModel/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,18 @@ protected function formatFailure($result)
$errorBlock = [];
if ($error->validationList) {
foreach ($error->validationList as $validation) {
$field = $inflector->normalize($validation->getField(), $appConfig['propertyFormatTo']);
if (!isset($errorBlock[$field])) {
$errorBlock[$field] = [];
if (is_array($validation->getField())) {
$fields = $validation->getField();
} else {
$fields = [$validation->getField()];
}
foreach($fields as $fieldName) {
$field = $inflector->normalize($fieldName, $appConfig['propertyFormatTo']);
if (!isset($errorBlock[$field])) {
$errorBlock[$field] = [];
}
$errorBlock[$field][] = $validation->getMessage();
}
$errorBlock[$field][] = $validation->getMessage();
}
}

Expand Down

0 comments on commit aaf51f7

Please sign in to comment.