Skip to content

Commit 7bf0222

Browse files
committed
Fixes setFieldPrefix usage
1 parent e2432eb commit 7bf0222

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/Exception/ValidationException.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ public function __construct($validation)
3636
{
3737
parent::__construct($this->resolveToValidator($validation));
3838

39-
$this->errors = $this->validator->errors();
40-
4139
$this->evalErrors();
4240
}
4341

@@ -75,12 +73,12 @@ protected function evalErrors()
7573
{
7674
$this->fields = [];
7775

78-
foreach ($this->errors->getMessages() as $field => $messages) {
76+
foreach ($this->errors() as $field => $messages) {
7977
$fieldName = implode('.', array_merge($this->fieldPrefix, [$field]));
8078
$this->fields[$fieldName] = (array) $messages;
8179
}
8280

83-
$this->message = $this->errors->first();
81+
$this->message = $this->getErrors()->first();
8482
}
8583

8684
/**
@@ -89,11 +87,11 @@ protected function evalErrors()
8987
*/
9088
public function getErrors()
9189
{
92-
return $this->errors;
90+
return $this->validator->errors();
9391
}
9492

9593
/**
96-
* getFields returns invalid fields
94+
* @deprecated use ->errors()
9795
*/
9896
public function getFields()
9997
{
@@ -108,5 +106,7 @@ public function setFieldPrefix(array $prefix)
108106
$this->fieldPrefix = array_filter($prefix, 'strlen');
109107

110108
$this->evalErrors();
109+
110+
$this->validator = $this->resolveToValidator($this->fields);
111111
}
112112
}

0 commit comments

Comments
 (0)