This tool will helps you upgrade your Symfony2 project.
1
stars
0
forks
source link
The methods setMessage(), getMessageTemplate() and getMessageParameters() in the ConstraintValidator class were deprecated and will be removed in Symfony 2.3. #46
The methods setMessage(), getMessageTemplate() and
getMessageParameters() in the ConstraintValidator class were deprecated and will
be removed in Symfony 2.3.
If you have implemented custom validators, you should use the
addViolation() method on the ExecutionContext object instead.
Before:
public function isValid($value, Constraint $constraint)
{
// ...
if (!$valid) {
$this->setMessage($constraint->message, array(
'{{ value }}' => $value,
));
return false;
}
}
After:
public function isValid($value, Constraint $constraint)
{
// ...
if (!$valid) {
$this->context->addViolation($constraint->message, array(
'{{ value }}' => $value,
));
return false;
}
}
The methods
setMessage()
,getMessageTemplate()
andgetMessageParameters()
in theConstraintValidator
class were deprecated and will be removed in Symfony 2.3.If you have implemented custom validators, you should use the
addViolation()
method on theExecutionContext
object instead.Before:
After: