You are here

public function LegacyConstraintViolationBuilder::addViolation in Plug 7

Adds the violation to the current execution context.

Overrides ConstraintViolationBuilderInterface::addViolation

File

lib/Symfony/validator/Symfony/Component/Validator/Violation/LegacyConstraintViolationBuilder.php, line 154

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);
}