interface ConstraintViolationBuilderInterface
Builds {@link \Symfony\Component\Validator\ConstraintViolationInterface} objects.
Use the various methods on this interface to configure the built violation. Finally, call {@link addViolation()} to add the violation to the current execution context.
$this | atPath(string $path) Stores the property path at which the violation should be generated. | |
$this | setParameter(string $key, string $value) Sets a parameter to be inserted into the violation message. | |
$this | setParameters(array $parameters) Sets all parameters to be inserted into the violation message. | |
$this | setTranslationDomain(string $translationDomain) Sets the translation domain which should be used for translating the violation message. | |
$this | setInvalidValue(mixed $invalidValue) Sets the invalid value that caused this violation. | |
$this | setPlural(int $number) Sets the number which determines how the plural form of the violation message is chosen when it is translated. | |
$this | setCode(string|null $code) Sets the violation code. | |
$this | setCause(mixed $cause) Sets the cause of the violation. | |
addViolation() Adds the violation to the current execution context. |
Stores the property path at which the violation should be generated.
The passed path will be appended to the current property path of the execution context.
string | $path | The property path |
$this |
Sets a parameter to be inserted into the violation message.
string | $key | The name of the parameter |
string | $value | The value to be inserted in the parameter's place |
$this |
Sets all parameters to be inserted into the violation message.
array | $parameters | An array with the parameter names as keys and the values to be inserted in their place as values |
$this |
Sets the translation domain which should be used for translating the violation message.
string | $translationDomain | The translation domain |
$this |
TranslatorInterface |
Sets the invalid value that caused this violation.
mixed | $invalidValue | The invalid value |
$this |
Sets the number which determines how the plural form of the violation message is chosen when it is translated.
int | $number | The number for determining the plural form |
$this |
TranslatorInterface::transChoice |
Sets the violation code.
string|null | $code | The violation code |
$this |
Sets the cause of the violation.
mixed | $cause | The cause of the violation |
$this |
Adds the violation to the current execution context.
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/Validator/Violation/ConstraintViolationBuilderInterface.html