Skip to content

Commit

Permalink
[Validator] removed deprecated methods
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Mar 23, 2013
1 parent 65e3b16 commit e0385a2
Show file tree
Hide file tree
Showing 25 changed files with 8 additions and 2,671 deletions.
84 changes: 0 additions & 84 deletions src/Symfony/Component/Validator/ConstraintValidator.php
Expand Up @@ -11,8 +11,6 @@

namespace Symfony\Component\Validator;

use Symfony\Component\Validator\Exception\ValidatorException;

/**
* Base class for constraint validators
*
Expand All @@ -27,93 +25,11 @@ abstract class ConstraintValidator implements ConstraintValidatorInterface
*/
protected $context;

/**
* @var string
*
* @deprecated
*/
private $messageTemplate;

/**
* @var array
*
* @deprecated
*/
private $messageParameters;

/**
* {@inheritDoc}
*/
public function initialize(ExecutionContextInterface $context)
{
$this->context = $context;
$this->messageTemplate = '';
$this->messageParameters = array();
}

/**
* {@inheritDoc}
*
* @deprecated Deprecated since version 2.1, to be removed in 2.3.
*/
public function getMessageTemplate()
{
trigger_error('getMessageTemplate() is deprecated since version 2.1 and will be removed in 2.3.', E_USER_DEPRECATED);

return $this->messageTemplate;
}

/**
* {@inheritDoc}
*
* @deprecated Deprecated since version 2.1, to be removed in 2.3.
*/
public function getMessageParameters()
{
trigger_error('getMessageParameters() is deprecated since version 2.1 and will be removed in 2.3.', E_USER_DEPRECATED);

return $this->messageParameters;
}

/**
* Wrapper for $this->context->addViolation()
*
* @deprecated Deprecated since version 2.1, to be removed in 2.3.
*/
protected function setMessage($template, array $parameters = array())
{
trigger_error('setMessage() is deprecated since version 2.1 and will be removed in 2.3.', E_USER_DEPRECATED);

$this->messageTemplate = $template;
$this->messageParameters = $parameters;

if (!$this->context instanceof ExecutionContext) {
throw new ValidatorException('ConstraintValidator::initialize() must be called before setting violation messages');
}

$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)
{
trigger_error('isValid() is deprecated since version 2.1 and will be removed in 2.3. Implement validate() instead.', E_USER_DEPRECATED);

return $this->isValid($value, $constraint);
}

/**
* BC variant of validate.
*
* @deprecated Deprecated since version 2.1, to be removed in 2.3.
*/
protected function isValid($value, Constraint $constraint)
{
}
}
126 changes: 0 additions & 126 deletions src/Symfony/Component/Validator/ExecutionContext.php
Expand Up @@ -112,64 +112,6 @@ public function addViolation($message, array $params = array(), $invalidValue =
));
}

/**
* Adds a violation at the validation graph node with the given property
* path.
*
* @param string $propertyPath The property path for the violation.
* @param string $message The error message.
* @param array $params The parameters parsed into the error message.
* @param mixed $invalidValue The invalid, validated value.
* @param integer|null $pluralization The number to use to pluralize of the message.
* @param integer|null $code The violation code.
*
* @deprecated Deprecated since version 2.2, to be removed in 2.3.
*/
public function addViolationAtPath($propertyPath, $message, array $params = array(), $invalidValue = null, $pluralization = null, $code = null)
{
trigger_error('addViolationAtPath() is deprecated since version 2.2 and will be removed in 2.3.', E_USER_DEPRECATED);

$this->globalContext->getViolations()->add(new ConstraintViolation(
null === $pluralization
? $this->translator->trans($message, $params, $this->translationDomain)
: $this->translator->transChoice($message, $pluralization, $params, $this->translationDomain),
$message,
$params,
$this->globalContext->getRoot(),
$propertyPath,
// check using func_num_args() to allow passing null values
func_num_args() >= 4 ? $invalidValue : $this->value,
$pluralization,
$code
));
}

/**
* Adds a violation at the validation graph node with the given property
* path relative to the current property path.
*
* @param string $subPath The relative property path for the violation.
* @param string $message The error message.
* @param array $params The parameters parsed into the error message.
* @param mixed $invalidValue The invalid, validated value.
* @param integer|null $pluralization The number to use to pluralize of the message.
* @param integer|null $code The violation code.
*
* @deprecated Deprecated since version 2.2, to be removed in 2.3. Use the
* method {@link addViolationAt} instead.
*/
public function addViolationAtSubPath($subPath, $message, array $params = array(), $invalidValue = null, $pluralization = null, $code = null)
{
trigger_error('addViolationAtSubPath() is deprecated since version 2.2 and will be removed in 2.3. Use addViolationAt() instead.', E_USER_DEPRECATED);

if (func_num_args() >= 4) {
$this->addViolationAt($subPath, $message, $params, $invalidValue, $pluralization, $code);
} else {
// Needed in order to make the check for func_num_args() inside work
$this->addViolationAt($subPath, $message, $params);
}
}

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -312,74 +254,6 @@ public function validateValue($value, $constraints, $subPath = '', $groups = nul
}
}

/**
* Returns the class name of the current node.
*
* @return string|null The class name or null, if the current node does not
* hold information about a class.
*
* @see getClassName
*
* @deprecated Deprecated since version 2.2, to be removed in 2.3. Use
* {@link getClassName} instead.
*/
public function getCurrentClass()
{
trigger_error('getCurrentClass() is deprecated since version 2.2 and will be removed in 2.3. Use getClassName() instead', E_USER_DEPRECATED);

return $this->getClassName();
}

/**
* Returns the property name of the current node.
*
* @return string|null The property name or null, if the current node does
* not hold information about a property.
*
* @see getPropertyName
*
* @deprecated Deprecated since version 2.2, to be removed in 2.3. Use
* {@link getClassName} instead.
*/
public function getCurrentProperty()
{
trigger_error('getCurrentProperty() is deprecated since version 2.2 and will be removed in 2.3. Use getClassName() instead', E_USER_DEPRECATED);

return $this->getPropertyName();
}

/**
* Returns the currently validated value.
*
* @return mixed The current value.
*
* @see getValue
*
* @deprecated Deprecated since version 2.2, to be removed in 2.3. Use
* {@link getValue} instead.
*/
public function getCurrentValue()
{
trigger_error('getCurrentValue() is deprecated since version 2.2 and will be removed in 2.3. Use getValue() instead', E_USER_DEPRECATED);

return $this->value;
}

/**
* Returns the graph walker instance.
*
* @return GraphWalker The graph walker.
*
* @deprecated Deprecated since version 2.2, to be removed in 2.3. Use
* {@link validate} and {@link validateValue} instead.
*/
public function getGraphWalker()
{
trigger_error('getGraphWalker() is deprecated since version 2.2 and will be removed in 2.3. Use validate() and validateValue() instead', E_USER_DEPRECATED);

return $this->globalContext->getVisitor()->getGraphWalker();
}

/**
* {@inheritdoc}
*/
Expand Down

0 comments on commit e0385a2

Please sign in to comment.