You are here

public function LegacyConstraintViolationBuilder::addViolation in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/validator/Violation/LegacyConstraintViolationBuilder.php \Symfony\Component\Validator\Violation\LegacyConstraintViolationBuilder::addViolation()

Adds the violation to the current execution context.

Overrides ConstraintViolationBuilderInterface::addViolation

File

vendor/symfony/validator/Violation/LegacyConstraintViolationBuilder.php, line 156

Class

LegacyConstraintViolationBuilder
Backwards-compatible implementation of {@link ConstraintViolationBuilderInterface}.

Namespace

Symfony\Component\Validator\Violation

Code

public function addViolation() {
  if ($this->propertyPath) {
    $this->context
      ->addViolationAt($this->propertyPath, $this->message, $this->parameters, $this->invalidValue, $this->plural, $this->code);
    return;
  }
  $this->context
    ->addViolation($this->message, $this->parameters, $this->invalidValue, $this->plural, $this->code);
}