LegacyConstraintViolationBuilder.php in Plug 7
File
lib/Symfony/validator/Symfony/Component/Validator/Violation/LegacyConstraintViolationBuilder.php
View source
<?php
namespace Symfony\Component\Validator\Violation;
use Symfony\Component\Validator\ExecutionContextInterface;
class LegacyConstraintViolationBuilder implements ConstraintViolationBuilderInterface {
private $context;
private $message;
private $parameters;
private $invalidValue;
private $propertyPath;
private $plural;
private $code;
public function __construct(ExecutionContextInterface $context, $message, array $parameters) {
$this->context = $context;
$this->message = $message;
$this->parameters = $parameters;
$this->invalidValue = $context
->getValue();
}
public function atPath($path) {
$this->propertyPath = $path;
return $this;
}
public function setParameter($key, $value) {
$this->parameters[$key] = $value;
return $this;
}
public function setParameters(array $parameters) {
$this->parameters = $parameters;
return $this;
}
public function setTranslationDomain($translationDomain) {
return $this;
}
public function setInvalidValue($invalidValue) {
$this->invalidValue = $invalidValue;
return $this;
}
public function setPlural($number) {
$this->plural = $number;
return $this;
}
public function setCode($code) {
$this->code = $code;
return $this;
}
public function setCause($cause) {
return $this;
}
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);
}
}