public function addViolation($message, array $params, $invalidValue) { $this->violations->add(new ConstraintViolation( $message, $params, $this->root, $this->propertyPath, $invalidValue )); }
/** * Wrapper for $this->context->addViolation() * * @deprecated */ protected function setMessage($template, array $parameters = array()) { $this->messageTemplate = $template; $this->messageParameters = $parameters; if (!$this->context instanceof ExecutionContext) { throw new ValidatorException('ConstraintValidator::initialize() must be called before setting violation messages'); } $this->context->addViolation($template, $parameters); }