ExecutionContextInterface::buildViolation()

ConstraintViolationBuilderInterface buildViolation(string $message, array $parameters = array())

Returns a builder for adding a violation with extended information.

Call {@link ConstraintViolationBuilderInterface::addViolation()} to add the violation when you're done with the configuration:

$context->buildViolation('Please enter a number between %min% and %max%.')
    ->setParameter('%min%', 3)
    ->setParameter('%max%', 10)
    ->setTranslationDomain('number_validation')
    ->addViolation();

Parameters

string $message The error message
array $parameters The parameters substituted in the error message

Return Value

ConstraintViolationBuilderInterface The violation builder
doc_Symfony
2016-10-28 06:15:54
Comments
Leave a Comment

Please login to continue.