public function ExecutionContext::addViolationAt

Adds a violation at the validation graph node with the given property path relative to the current property path.

@api

Parameters

string $subPath The relative property path for the violation.:

string $message The error message.:

array $params The parameters substituted in the error message.:

mixed $invalidValue The invalid, validated value.:

integer|null $pluralization The number to use to pluralize of the message.:

integer|null $code The violation code.:

Overrides ExecutionContextInterface::addViolationAt

File

drupal/core/vendor/symfony/validator/Symfony/Component/Validator/ExecutionContext.php, line 118

Class

ExecutionContext
Default implementation of {@link ExecutionContextInterface}.

Namespace

Symfony\Component\Validator

Code

public function addViolationAt($subPath, $message, array $params = array(), $invalidValue = null, $pluralization = null, $code = null) {
  $this->globalContext
    ->getViolations()
    ->add(new ConstraintViolation(null === $pluralization ? $this->translator
    ->trans($message, $params, $this->translationDomain) : $this->translator
    ->transChoice($message, $pluralization, $params, $this->translationDomain), $message, $params, $this->globalContext
    ->getRoot(), $this
    ->getPropertyPath($subPath), func_num_args() >= 4 ? $invalidValue : $this->value, $pluralization, $code));
}