class FormError implements Serializable

Wraps errors in forms.

Methods

__construct(string $message, string|null $messageTemplate = null, array $messageParameters = array(), int|null $messagePluralization = null, mixed $cause = null)

Constructor.

string
getMessage()

Returns the error message.

string
getMessageTemplate()

Returns the error message template.

array
getMessageParameters()

Returns the parameters to be inserted in the message template.

int|null
getMessagePluralization()

Returns the value for error message pluralization.

mixed
getCause()

Returns the cause of this error.

setOrigin(FormInterface $origin)

Sets the form that caused this error.

getOrigin()

Returns the form that caused this error.

string
serialize()

Serializes this error.

unserialize(string $serialized)

Unserializes a serialized error.

Details

at line line 78
__construct(string $message, string|null $messageTemplate = null, array $messageParameters = array(), int|null $messagePluralization = null, mixed $cause = null)

Constructor.

Any array key in $messageParameters will be used as a placeholder in $messageTemplate.

Parameters

string $message The translated error message
string|null $messageTemplate The template for the error message
array $messageParameters The parameters that should be substituted in the message template
int|null $messagePluralization The value for error message pluralization
mixed $cause The cause of the error

See also

\Symfony\Component\Translation\Translator

at line line 92
string getMessage()

Returns the error message.

Return Value

string

at line line 102
string getMessageTemplate()

Returns the error message template.

Return Value

string

at line line 112
array getMessageParameters()

Returns the parameters to be inserted in the message template.

Return Value

array

at line line 122
int|null getMessagePluralization()

Returns the value for error message pluralization.

Return Value

int|null

at line line 132
mixed getCause()

Returns the cause of this error.

Return Value

mixed The cause of this error

at line line 146
setOrigin(FormInterface $origin)

Sets the form that caused this error.

This method must only be called once.

Parameters

FormInterface $origin The form that caused this error

Exceptions

BadMethodCallException If the method is called more than once

at line line 160
FormInterface getOrigin()

Returns the form that caused this error.

Return Value

FormInterface The form that caused this error

at line line 170
string serialize()

Serializes this error.

Return Value

string The serialized error

at line line 186
unserialize(string $serialized)

Unserializes a serialized error.

Parameters

string $serialized The serialized error