function ExecutionContext::addViolation
Same name in other branches
- 8.9.x core/lib/Drupal/Core/TypedData/Validation/ExecutionContext.php \Drupal\Core\TypedData\Validation\ExecutionContext::addViolation()
- 10 core/lib/Drupal/Core/Validation/ExecutionContext.php \Drupal\Core\Validation\ExecutionContext::addViolation()
- 11.x core/lib/Drupal/Core/Validation/ExecutionContext.php \Drupal\Core\Validation\ExecutionContext::addViolation()
File
-
core/
lib/ Drupal/ Core/ TypedData/ Validation/ ExecutionContext.php, line 159
Class
- ExecutionContext
- Defines an execution context class.
Namespace
Drupal\Core\TypedData\ValidationCode
public function addViolation($message, array $parameters = [], $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));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.