Skip to content

Commit

Permalink
Merge pull request #1197 from samsonasik/validation-get-errors
Browse files Browse the repository at this point in the history
use Validation->getErrors() call instead of Valdation::errors to handle errors that came from session
  • Loading branch information
lonnieezell authored Sep 5, 2018
2 parents b97dbf8 + 337f29a commit 5b1257c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions system/Validation/Validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public function run(array $data = null, string $group = null): bool
$this->processRules($rField, $rSetup['label'] ?? $rField, $value ?? null, $rules, $data);
}

return ! empty($this->errors) ? false : true;
return ! empty($this->getErrors()) ? false : true;
}

//--------------------------------------------------------------------
Expand Down Expand Up @@ -491,7 +491,7 @@ public function listErrors(string $template = 'list'): string
*/
public function showError(string $field, string $template = 'single'): string
{
if ( ! array_key_exists($field, $this->errors))
if ( ! array_key_exists($field, $this->getErrors()))
{
return '';
}
Expand Down Expand Up @@ -579,7 +579,7 @@ protected function loadRuleGroup(string $group = null)
*/
public function hasError(string $field): bool
{
return array_key_exists($field, $this->errors);
return array_key_exists($field, $this->getErrors());
}

//--------------------------------------------------------------------
Expand All @@ -600,7 +600,7 @@ public function getError(string $field = null): string
$field = key($this->rules);
}

return array_key_exists($field, $this->errors) ? $this->errors[$field] : '';
return array_key_exists($field, $this->getErrors()) ? $this->errors[$field] : '';
}

//--------------------------------------------------------------------
Expand All @@ -615,11 +615,11 @@ public function getError(string $field = null): string
* ]
*
* @return array
*
*
* Excluded from code coverage because that it always run as cli
*
*
* @codeCoverageIgnore
*
*
*/
public function getErrors(): array
{
Expand Down

0 comments on commit 5b1257c

Please sign in to comment.