Copied!

ValidationError

ValidationError.php : 19
Interface
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 : 36

Returns the target element on which the error occurred.

public getTarget() : string|null

Return values

string|null

publicgetTranslatableMessage()

Translatable.php : 23

Returns a translatable Message.

public getTranslatableMessage() : Translation

Return values

Translation

publicsetTarget()

ValidationError.php : 31

Sets the target element on which the error occurred.

public setTarget(string $target) : void

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 the "minStringLength" key under "StringLengthValidator" key (field type validator configuration)
  • "my_field_definition_identifier"

Parameters

Name Type Default value Description
$target string - -