Skip to content

Commit

Permalink
fixed deprecation notice
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Feb 10, 2015
1 parent 97cff75 commit 1adf54b
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/Symfony/Component/Validator/Constraints/LengthValidator.php
Expand Up @@ -65,11 +65,19 @@ public function validate($value, Constraint $constraint)
}

if ($invalidCharset) {
$this->buildViolation($constraint->charsetMessage)
->setParameter('{{ value }}', $this->formatValue($stringValue))
->setParameter('{{ charset }}', $constraint->charset)
->setInvalidValue($value)
->addViolation();
if ($this->context instanceof ExecutionContextInterface) {
$this->context->buildViolation($constraint->charsetMessage)
->setParameter('{{ value }}', $this->formatValue($stringValue))
->setParameter('{{ charset }}', $constraint->charset)
->setInvalidValue($value)
->addViolation();
} else {
$this->buildViolation($constraint->charsetMessage)
->setParameter('{{ value }}', $this->formatValue($stringValue))
->setParameter('{{ charset }}', $constraint->charset)
->setInvalidValue($value)
->addViolation();
}

return;
}
Expand Down

0 comments on commit 1adf54b

Please sign in to comment.