Returns the models errors with proper messages.

@return array
544518
public function errorMessages()
    {
        $messages = array();

        // Loop over each field
        foreach ($this->errors as $field => $errors) {
            $messages[$field] = array();

            // Loop over the fields errors
            foreach ($errors as $validation => $error) {
                $vars = array_merge(
                    array('field' => Language::translate($field)),
                    $error
                );
                unset($vars['message']);
                $messages[$field][] = Language::translate($error['message'], $vars);
            }
        }

        return $messages;
    }
14687
public function getErrors(): array {
        $result = [];
        foreach ($this->getRawErrors() as $field => $error) {
            $result[] = $this->pluckError(['field' => $field] + $error);
        }
        return $result;
    }
695510
public function getAllErrors()
    {
        $errors = $this->getErrors();

        $types = $this->getClasses()->merge($this->getInterfaces())->merge($this->getTraits());

        $elements = $this->getFunctions()->merge($this->getConstants())->merge($types);

        foreach ($elements as $element) {
            if (!$element) {
                continue;
            }

            $errors = $errors->merge($element->getErrors());
        }

        foreach ($types as $element) {
            if (!$element) {
                continue;
            }

            foreach ($element->getMethods() as $item) {
                if (!$item) {
                    continue;
                }

                $errors = $errors->merge($item->getErrors());
            }

            if (method_exists($element, 'getConstants')) {
                foreach ($element->getConstants() as $item) {
                    if (!$item) {
                        continue;
                    }

                    $errors = $errors->merge($item->getErrors());
                }
            }

            if (method_exists($element, 'getProperties')) {
                foreach ($element->getProperties() as $item) {
                    if (!$item) {
                        continue;
                    }

                    $errors = $errors->merge($item->getErrors());
                }
            }
        }

        return $errors;
    }
1251456
public static function checkModel($errors, Model $model) : array
    {
        $output = [];
        if (!is_array($errors)) {
            return $output;
        }
        foreach ($errors as $attribute => $message) {
            $obj = $model;
            if (strpos($attribute, '.') !== false) {
                list($nested, $attr) = explode('.', $attribute);
                if (isset($obj->{$nested}) && $obj->{$nested} instanceof Model) {
                    $obj       = $obj->{$nested};
                    $attribute = $attr;
                }
            }
            if ($obj->hasProperty($attribute)) {
                $output[Html::getInputId($obj, $attribute)] = $message;
            } else {
                $output[] = $message;
            }
        }
        return $output;
    }
722514
public function getValidationErrors()
    {
        if ($this->isValid()) {
            return [];
        }
        
        // if it's already cached, just return it
        if (count($this->validationErrors) > 0) {
            return $this->validationErrors;
        }


        // All errors can be spotted in the fields
        foreach ($this->getFields() as $field) {
            if (!$field->isValid()) {
                $this->validationErrors[$field->getName()] = $field->getErrors(true);
            }
        }

        return $this->validationErrors;
    }
55735
public function _error(){
		$model = new ViewModel('application/error');
		$model->addVariable('error_type','error');
		$model->addVariable('error',ErrorController::$errors);
		return $model;
	}
1193804
public function getMissingErrors()
    {
        return array_combine(
            array_keys($this->missingAttribs),
            array_map(function ($ref) {
                return $ref['error'];
            }, array_values($this->missingAttribs))
        );
    }
176466
public function getErrors()
    {
        $errors = array();
        /** @var \tao_helpers_form_Validator $validator */
        foreach ($this->validators as $validator) {
            $errors[] = $validator->getMessage();
        }

        return $errors;
    }
38248
public function getAllErrors() {

        $errors = array();
        // First the structure itself
        if ($this->getError()) {
            $errors[] = $this->getError();
        }
        // Delegate to tables
        if ($this->tables) {
            foreach ($this->tables as $table) {
                if ($tableerrors = $table->getAllErrors()) {

                }
            }
            // Add them to the errors array
            if ($tableerrors) {
                $errors = array_merge($errors, $tableerrors);
            }
        }
        // Return decision
        if (count($errors)) {
            return $errors;
        } else {
            return false;
        }
    }
586750
public function get_error(){
    if ( $this->error ){
      return [
        'code' => $this->error,
        'text' => $this->class_cfg['errors'][$this->error]
      ];
    }
    return false;
  }
945009
public static function getErrors()
	{
		$list	= array();
		foreach( $this->errors as $errorKey )
			$list[$errorKey]	= self::$rules[$errorKey];
		return $list;
	}
702736
public function exportErrors()
    {
        $ret = [];
        foreach ($this->errors as $error) {
            $ret[] = $error->export();
        }
        return $ret;
    }
204986
public function error_messages(){
        $messages= array();
        foreach ($this->fieldsState as $fieldState) {
            //Si no es valido agrego el mensaje de error
            if(! $fieldState['valid']){
                $name= $fieldState['name'];
                $messages["$name"]= $fieldState['message'];
            }
        }
        return $messages;
    }
1051531
public function getErrors(): array
    {
        $errors = $this->validate()->getErrors();
        foreach ($errors as &$error) {
            if (is_string($error) && Translator::isMessage($error)) {
                // translate error message
                $error = $this->say($error);
            }

            unset($error);
        }

        return $errors;
    }
151390
public function any_error_messages() {
        $errors = array();
        foreach ($this->get_all_slots() as $slot) {
            foreach ($this->for_slot($slot)->get_sub_question_ids() as $subqid) {
                if ($this->for_subq($subqid)->differentweights) {
                    $name = $this->for_subq($subqid)->question->name;
                    $errors[] = get_string('erroritemappearsmorethanoncewithdifferentweight', 'question', $name);
                }
            }
        }
        return $errors;
    }
304949
public function getActionMessages() {
        $messages = $this->getAttribute(ACTION_MESSAGES_KEY);
        if ($messages === null)
            $messages = [];
        $errors = $this->getActionErrors();

        return \array_merge($messages, $errors);
    }
150822
public function getAllErrors() : array
    {
        $errors = $this->getErrors();

        foreach ($this->components as $component) {
            $errors = array_merge($errors, $component->getErrors());
        }

        return $errors;
    }