You are here

protected function ConstraintValidator::buildViolationInContext in Plug 7

Wrapper for {@link ExecutionContextInterface::buildViolation} that supports the 2.4 context API.

Parameters

ExecutionContextInterface $context The context to use:

string $message The violation message:

array $parameters The message parameters:

Return value

ConstraintViolationBuilderInterface The violation builder

Deprecated

This method will be removed in Symfony 3.0.

File

lib/Symfony/validator/Symfony/Component/Validator/ConstraintValidator.php, line 87

Class

ConstraintValidator
Base class for constraint validators.

Namespace

Symfony\Component\Validator

Code

protected function buildViolationInContext(ExecutionContextInterface $context, $message, array $parameters = array()) {
  if ($context instanceof ExecutionContextInterface2Dot5) {
    return $context
      ->buildViolation($message, $parameters);
  }
  return new LegacyConstraintViolationBuilder($context, $message, $parameters);
}