Skip to content
Permalink
Browse files

Simplifying EntityTrait::errors()

  • Loading branch information...
burzum committed Jan 30, 2017
1 parent b49e6ed commit 4b07ec9c5d3cbc02ed25ba2f6f4f9b8ebbebc3f8
Showing with 2 additions and 14 deletions.
  1. +2 −14 src/Datasource/EntityTrait.php
@@ -945,26 +945,14 @@ public function errors($field = null, $errors = null, $overwrite = false)
}
if (is_string($field) && $errors === null) {
$errors = isset($this->_errors[$field]) ? $this->_errors[$field] : [];
if ($errors) {
return $errors;
}
return $this->_nestedErrors($field);
return $this->getError($field);
}
if (!is_array($field)) {
$field = [$field => $errors];
}
foreach ($field as $f => $error) {
$this->_errors += [$f => []];
$this->_errors[$f] = $overwrite ?
(array)$error :
array_merge($this->_errors[$f], (array)$error);
}
return $this;
return $this->setErrors($field, $overwrite);
}
/**

0 comments on commit 4b07ec9

Please sign in to comment.
You can’t perform that action at this time.