You are here

public function ExecutionContext::addViolationAt in Zircon Profile 8

Same name in this branch
  1. 8 vendor/symfony/validator/ExecutionContext.php \Symfony\Component\Validator\ExecutionContext::addViolationAt()
  2. 8 vendor/symfony/validator/Context/ExecutionContext.php \Symfony\Component\Validator\Context\ExecutionContext::addViolationAt()
  3. 8 core/lib/Drupal/Core/TypedData/Validation/ExecutionContext.php \Drupal\Core\TypedData\Validation\ExecutionContext::addViolationAt()
Same name and namespace in other branches
  1. 8.0 vendor/symfony/validator/Context/ExecutionContext.php \Symfony\Component\Validator\Context\ExecutionContext::addViolationAt()

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

Parameters

string $subPath The relative property path for the violation:

string $message The error message:

array $parameters The parameters substituted in the error message:

mixed $invalidValue The invalid, validated value:

int|null $plural The number to use to pluralize of the message:

int|null $code The violation code:

Overrides ExecutionContextInterface::addViolationAt

Deprecated

since version 2.5, to be removed in 3.0. Use {@link Context\ExecutionContextInterface::buildViolation()} instead.

File

vendor/symfony/validator/Context/ExecutionContext.php, line 319

Class

ExecutionContext
The context used and created by {@link ExecutionContextFactory}.

Namespace

Symfony\Component\Validator\Context

Code

public function addViolationAt($subPath, $message, array $parameters = array(), $invalidValue = null, $plural = null, $code = null) {
  @trigger_error('The ' . __METHOD__ . ' method is deprecated since version 2.5 and will be removed in 3.0. Use the ' . __CLASS__ . '::buildViolation method instead.', E_USER_DEPRECATED);
  if (func_num_args() > 2) {
    $this
      ->buildViolation($message, $parameters)
      ->atPath($subPath)
      ->setInvalidValue($invalidValue)
      ->setPlural($plural)
      ->setCode($code)
      ->addViolation();
    return;
  }
  $this
    ->buildViolation($message, $parameters)
    ->atPath($subPath)
    ->addViolation();
}