You are here

public function ExecutionContextInterface::buildViolation in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/validator/Context/ExecutionContextInterface.php \Symfony\Component\Validator\Context\ExecutionContextInterface::buildViolation()

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

2 methods override ExecutionContextInterface::buildViolation()
ExecutionContext::buildViolation in vendor/symfony/validator/Context/ExecutionContext.php
Returns a builder for adding a violation with extended information.
ExecutionContext::buildViolation in core/lib/Drupal/Core/TypedData/Validation/ExecutionContext.php
Returns a builder for adding a violation with extended information.

File

vendor/symfony/validator/Context/ExecutionContextInterface.php, line 82

Class

ExecutionContextInterface
The context of a validation run.

Namespace

Symfony\Component\Validator\Context

Code

public function buildViolation($message, array $parameters = array());