ConstraintViolationBuilder::setPlural()

ConstraintViolationBuilderInterface 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 ConstraintViolationBuilderInterface This builder

ConstraintViolationBuilder::setParameters()

ConstraintViolationBuilderInterface 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 ConstraintViolationBuilderInterface This builder

ConstraintViolationBuilder::setParameter()

ConstraintViolationBuilderInterface 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 ConstraintViolationBuilderInterface This builder

ConstraintViolationBuilder::setInvalidValue()

ConstraintViolationBuilderInterface setInvalidValue(mixed $invalidValue) Sets the invalid value that caused this violation. Parameters mixed $invalidValue The invalid value Return Value ConstraintViolationBuilderInterface This builder

ConstraintViolationBuilder::setCode()

ConstraintViolationBuilderInterface setCode(string|null $code) Sets the violation code. Parameters string|null $code The violation code Return Value ConstraintViolationBuilderInterface This builder

ConstraintViolationBuilder::setCause()

ConstraintViolationBuilderInterface setCause(mixed $cause) Sets the cause of the violation. Parameters mixed $cause The cause of the violation Return Value ConstraintViolationBuilderInterface This builder

ConstraintViolationBuilder::atPath()

ConstraintViolationBuilderInterface 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 ConstraintViolationBuilderInterface This builder

ConstraintViolationBuilder

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) ConstraintViolationBuilderInterface atPath(string $path) Stores the property path at which the violation should be generated.

ConstraintViolationBuilder::addViolation()

addViolation() Adds the violation to the current execution context.

ConstraintViolation::getRoot()

mixed getRoot() Returns the root element of the validation. Return Value mixed The value that was passed originally to the validator when the validation was started. Because the validator traverses the object graph, the value at which the violation occurs is not necessarily the value that was originally validated.