You are here

public function LegacyExecutionContext::addViolationAt in Plug 7

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 $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 ExecutionContext::addViolationAt

Deprecated

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

File

lib/Symfony/validator/Symfony/Component/Validator/Context/LegacyExecutionContext.php, line 78

Class

LegacyExecutionContext
An execution context that is compatible with the legacy API (< 2.5).

Namespace

Symfony\Component\Validator\Context

Code

public function addViolationAt($subPath, $message, array $parameters = array(), $invalidValue = null, $plural = null, $code = null) {
  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();
}