public function getFirstErrors() { if (empty($this->_errors)) { return []; } else { $errors = []; foreach ($this->_errors as $name => $es) { if (!empty($es)) { $errors[$name] = reset($es); } } return $errors; } }
/** * @return array */ public function getErrors() { if (empty($this->_errors)) { foreach ($this->_model->getFirstErrors() as $name => $message) { $this->_errors[] = ['field' => $name, 'message' => $message]; } } return $this->_errors; }