ConstraintViolationBuilderInterface
in
Builds {@link \Symfony\Component\Validator\ConstraintViolationInterface} objects.
Use the various methods on this interface to configure the built violation. Finally, call to add the violation to the current execution context.
Tags
Table of Contents
Methods
- addViolation() : mixed
- Adds the violation to the current execution context.
- atPath() : $this
- Stores the property path at which the violation should be generated.
- setCause() : $this
- Sets the cause of the violation.
- setCode() : $this
- Sets the violation code.
- setInvalidValue() : $this
- Sets the invalid value that caused this violation.
- setParameter() : $this
- Sets a parameter to be inserted into the violation message.
- setParameters() : $this
- Sets all parameters to be inserted into the violation message.
- setPlural() : $this
- Sets the number which determines how the plural form of the violation message is chosen when it is translated.
- setTranslationDomain() : $this
- Sets the translation domain which should be used for translating the violation message.
Methods
addViolation()
Adds the violation to the current execution context.
public
addViolation() : mixed
atPath()
Stores the property path at which the violation should be generated.
public
atPath(string $path) : $this
The passed path will be appended to the current property path of the execution context.
Parameters
- $path : string
-
The property path
Return values
$thissetCause()
Sets the cause of the violation.
public
setCause(mixed $cause) : $this
Parameters
- $cause : mixed
-
The cause of the violation
Return values
$thissetCode()
Sets the violation code.
public
setCode(string|null $code) : $this
Parameters
- $code : string|null
-
The violation code
Return values
$thissetInvalidValue()
Sets the invalid value that caused this violation.
public
setInvalidValue(mixed $invalidValue) : $this
Parameters
- $invalidValue : mixed
Return values
$thissetParameter()
Sets a parameter to be inserted into the violation message.
public
setParameter(string $key, string $value) : $this
Parameters
- $key : string
-
The name of the parameter
- $value : string
-
The value to be inserted in the parameter's place
Return values
$thissetParameters()
Sets all parameters to be inserted into the violation message.
public
setParameters(array<string|int, mixed> $parameters) : $this
Parameters
- $parameters : array<string|int, mixed>
-
An array with the parameter names as keys and the values to be inserted in their place as values
Return values
$thissetPlural()
Sets the number which determines how the plural form of the violation message is chosen when it is translated.
public
setPlural(int $number) : $this
Parameters
- $number : int
-
The number for determining the plural form
Tags
Return values
$thissetTranslationDomain()
Sets the translation domain which should be used for translating the violation message.
public
setTranslationDomain(string $translationDomain) : $this
Parameters
- $translationDomain : string
-
The translation domain