public function ExecutionContext::addViolation in Zircon Profile 8
Same name in this branch
- 8 vendor/symfony/validator/ExecutionContext.php \Symfony\Component\Validator\ExecutionContext::addViolation()
- 8 vendor/symfony/validator/Context/ExecutionContext.php \Symfony\Component\Validator\Context\ExecutionContext::addViolation()
- 8 core/lib/Drupal/Core/TypedData/Validation/ExecutionContext.php \Drupal\Core\TypedData\Validation\ExecutionContext::addViolation()
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/TypedData/Validation/ExecutionContext.php \Drupal\Core\TypedData\Validation\ExecutionContext::addViolation()
Adds a violation at the current node of the validation graph.
Note: the parameters $invalidValue, $plural and $code are deprecated since version 2.5 and will be removed in 3.0.
Parameters
string $message The error message:
array $params The parameters substituted in the error message:
mixed $invalidValue The invalid, validated value:
int|null $plural The number to use to pluralize of the message:
int|null $code The violation code:
Overrides ExecutionContextInterface::addViolation
File
- core/
lib/ Drupal/ Core/ TypedData/ Validation/ ExecutionContext.php, line 163 - Contains \Drupal\Core\TypedData\Validation\ExecutionContext.
Class
- ExecutionContext
- Defines an execution context class.
Namespace
Drupal\Core\TypedData\ValidationCode
public function addViolation($message, array $parameters = array(), $invalidValue = NULL, $plural = NULL, $code = NULL) {
// The parameters $invalidValue and following are ignored by the new
// API, as they are not present in the new interface anymore.
// You should use buildViolation() instead.
if (func_num_args() > 2) {
throw new \LogicException('Legacy validator API is unsupported.');
}
$this->violations
->add(new ConstraintViolation($this->translator
->trans($message, $parameters, $this->translationDomain), $message, $parameters, $this->root, $this->propertyPath, $this->value, NULL, NULL, $this->constraint));
}