class ConstraintViolationBuilder implements ConstraintViolationBuilderInterface

Default implementation of {@link ConstraintViolationBuilderInterface}.

Methods

__construct(ConstraintViolationList $violations, Constraint $constraint, $message, array $parameters, $root, $propertyPath, $invalidValue, TranslatorInterface $translator, $translationDomain = null)

No description

$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.

Details

at line line 46
__construct(ConstraintViolationList $violations, Constraint $constraint, $message, array $parameters, $root, $propertyPath, $invalidValue, TranslatorInterface $translator, $translationDomain = null)

Parameters

ConstraintViolationList $violations
Constraint $constraint
$message
array $parameters
$root
$propertyPath
$invalidValue
TranslatorInterface $translator
$translationDomain

at line line 62
$this atPath(string $path)

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.

Parameters

string $path The property path

Return Value

$this

at line line 72
$this setParameter(string $key, string $value)

Sets a parameter to be inserted into the violation message.

Parameters

string $key The name of the parameter
string $value The value to be inserted in the parameter's place

Return Value

$this

at line line 82
$this setParameters(array $parameters)

Sets all parameters to be inserted into the violation message.

Parameters

array $parameters An array with the parameter names as keys and the values to be inserted in their place as values

Return Value

$this

at line line 92
$this setTranslationDomain(string $translationDomain)

Sets the translation domain which should be used for translating the violation message.

Parameters

string $translationDomain The translation domain

Return Value

$this

at line line 102
$this setInvalidValue(mixed $invalidValue)

Sets the invalid value that caused this violation.

Parameters

mixed $invalidValue The invalid value

Return Value

$this

at line line 112
$this setPlural(int $number)

Sets the number which determines how the plural form of the violation message is chosen when it is translated.

Parameters

int $number The number for determining the plural form

Return Value

$this

at line line 122
$this setCode(string|null $code)

Sets the violation code.

Parameters

string|null $code The violation code

Return Value

$this

at line line 132
$this setCause(mixed $cause)

Sets the cause of the violation.

Parameters

mixed $cause The cause of the violation

Return Value

$this

at line line 142
addViolation()

Adds the violation to the current execution context.