Copied!

ValidationError

ValidationError.php : 18
Extends Translatable

Interface for validation errors.

Enforces to return a translatable message, since it will be necessary to present validation errors to the user. Thus we need plural form handling and replacements of placeholders and so on.

Methods

publicgetTarget()

ValidationError.php : 39

Returns the target element on which the error occurred.

public getTarget() : string

Return values

string

publicgetTranslatableMessage()

Translatable.php : 21

Returns a translatable Message.

public getTranslatableMessage() : Translation

Return values

Translation

publicsetTarget()

ValidationError.php : 32

Sets the target element on which the error occurred.

public setTarget(string $target) : mixed

E.g. Property of a Field value which didn't validate against validation. Can be a property path compatible with Symfony PropertyAccess component.

Examples:

  • "[StringLengthValidator][minStringLength]" => Target is "minStringLength" key under "StringLengthValidator" key (fieldtype validator configuration)
  • "my_field_definition_identifier"

Parameters

Name Type Default value Description
$target string - -