LegacyConstraintViolationBuilder.php in Zircon Profile 8
File
vendor/symfony/validator/Violation/LegacyConstraintViolationBuilder.php
View source
<?php
namespace Symfony\Component\Validator\Violation;
@trigger_error('The ' . __NAMESPACE__ . '\\LegacyConstraintViolationBuilder class is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
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);
}
}