public function LegacyExecutionContext::addViolation in Plug 7
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.
@api
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 ExecutionContext::addViolation
File
- lib/
Symfony/ validator/ Symfony/ Component/ Validator/ Context/ LegacyExecutionContext.php, line 58
Class
- LegacyExecutionContext
- An execution context that is compatible with the legacy API (< 2.5).
Namespace
Symfony\Component\Validator\ContextCode
public function addViolation($message, array $parameters = array(), $invalidValue = null, $plural = null, $code = null) {
if (func_num_args() > 2) {
$this
->buildViolation($message, $parameters)
->setInvalidValue($invalidValue)
->setPlural($plural)
->setCode($code)
->addViolation();
return;
}
parent::addViolation($message, $parameters);
}