src/AbstractResource.php
protected function setError($field, $errorType, $error) {
        if (is_array($error)) {
            if (!array_key_exists('status', $error)) {
                $error['status'] = 400;
            }
            $error = $this->getFactory()->newError($error);
        }

        return $this->setJsonApiError($field, $errorType, $error);
    }
protected function setError($field, $errorType, $error) {
        if (is_array($error)) {
            if (!array_key_exists('status', $error)) {
                $error['status'] = 400;
            }
            $error = $this->getFactory()->newError($error);
        }

        return $this->setJsonApiError($field, $errorType, $error);
    }
protected function setError ( $ field , $ errorType , $ error ) { if ( is_array ( $ error ) ) { if ( ! array_key_exists ( 'status' , $ error ) ) { $ error [ 'status' ] = 400 ; } $ error = $ this -> getFactory ( ) -> newError ( $ error ) ; } return $ this -> setJsonApiError ( $ field , $ errorType , $ error ) ; }
Make it easier to set errors on objects

@param string $field The field name to which to attach the error
@param string $errorType An arbitrary type specifier for adding multiple different types of errors
to a field
@param array $error An array of JSON API-compatible error fields (like "title" and "detail")
@return static
Make it easier to set errors on objects