ErrorList
class ErrorList implements ArrayAccess, JsonSerializable (View source)
Properties
protected ErrorInterface[] | $errors |
Methods
No description
{@inheritdoc}
{@inheritdoc}
{@inheritdoc}
{@inheritdoc}
Add an error message/object or exception to the internal error array.
Add an error message/object or exception to the internal error array (error messages are in plain text if not otherwise specified).
Add an error message/object or exception to the internal error array (error messages are in HTML if not otherwise specified).
Get the list of errors contained in this error list.
Returns whether or not this error list has more than zero error registered within it.
{@inheritdoc}
Render this error list as a plain text.
Create a JSON response describing the errors in this list.
Details
string
__toString()
No description
offsetExists($offset)
{@inheritdoc}
ErrorInterface|null
offsetGet($offset)
{@inheritdoc}
offsetSet($offset, $value)
{@inheritdoc}
offsetUnset($offset)
{@inheritdoc}
$this
addError(ErrorInterface|Exception|Throwable|ErrorList|string $e, bool $isHtml = false, string|null $fieldName = null, string|null $fieldDisplayName = null)
Add an error message/object or exception to the internal error array.
$this
add(ErrorInterface|Exception|Throwable|ErrorList|string $e, string|null $fieldName = null, string|null $fieldDisplayName = null)
Add an error message/object or exception to the internal error array (error messages are in plain text if not otherwise specified).
$this
addHtml(ErrorInterface|Exception|Throwable|ErrorList|string $e, string|null $fieldName = null, string|null $fieldDisplayName = null)
Add an error message/object or exception to the internal error array (error messages are in HTML if not otherwise specified).
ErrorInterface[]
getList()
Get the list of errors contained in this error list.
bool
has()
Returns whether or not this error list has more than zero error registered within it.
string
output()
deprecated
deprecated
No description
string
outputJSON()
deprecated
deprecated
No description
array|null
jsonSerialize()
{@inheritdoc}
string
toText()
Render this error list as a plain text.
bool
containsField(FieldInterface|string $field)
Does this list contain error associated to a field?
string|false
getMessage(FieldInterface|string $field)
Get the error message (if any) associated to a field.
JsonResponse
createResponse(int $errorCode = JsonResponse::HTTP_BAD_REQUEST)
Create a JSON response describing the errors in this list.