Skip to content

Commit

Permalink
[Validator] Added default validate() implementation to ConstraintVali…
Browse files Browse the repository at this point in the history
…dator for BC
  • Loading branch information
webmozart committed Apr 17, 2012
1 parent 6336d93 commit dc059ab
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions src/Symfony/Component/Validator/ConstraintValidator.php
Expand Up @@ -11,15 +11,15 @@

namespace Symfony\Component\Validator;

use Symfony\Component\Validator\Exception\ValidatorException;

/**
* Base class for constraint validators
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @api
*/
use Symfony\Component\Validator\Exception\ValidatorException;

abstract class ConstraintValidator implements ConstraintValidatorInterface
{
/**
Expand Down Expand Up @@ -54,7 +54,7 @@ public function initialize(ExecutionContext $context)
/**
* {@inheritDoc}
*
* @deprecated
* @deprecated Deprecated since version 2.1, to be removed in 2.3.
*/
public function getMessageTemplate()
{
Expand All @@ -64,7 +64,7 @@ public function getMessageTemplate()
/**
* {@inheritDoc}
*
* @deprecated
* @deprecated Deprecated since version 2.1, to be removed in 2.3.
*/
public function getMessageParameters()
{
Expand All @@ -74,7 +74,7 @@ public function getMessageParameters()
/**
* Wrapper for $this->context->addViolation()
*
* @deprecated
* @deprecated Deprecated since version 2.1, to be removed in 2.3.
*/
protected function setMessage($template, array $parameters = array())
{
Expand All @@ -87,4 +87,25 @@ protected function setMessage($template, array $parameters = array())

$this->context->addViolation($template, $parameters);
}

/**
* Stub implementation delegating to the deprecated isValid method.
*
* This stub exists for BC and will be dropped in Symfony 2.3.
*
* @see ConstraintValidatorInterface::validate
*/
public function validate($value, Constraint $constraint)
{
return $this->isValid($valoue, $constraint);
}

/**
* BC variant of validate.
*
* @deprecated Deprecated since version 2.1, to be removed in 2.3.
*/
protected function isValid($value, Constraint $constraint)
{
}
}

0 comments on commit dc059ab

Please sign in to comment.