- /**
- * {@inheritdoc}
- */
- public function addViolationAt($subPath, $message, array $parameters = array(), $invalidValue = null, $plural = null, $code = null)
- {
- @trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the '.__CLASS__.'::buildViolation method instead.', E_USER_DEPRECATED);
-
- if (func_num_args() > 2) {
- $this
- ->buildViolation($message, $parameters)
- ->atPath($subPath)
- ->setInvalidValue($invalidValue)
- ->setPlural($plural)
- ->setCode($code)
- ->addViolation()
- ;
-
- return;
- }
-
- $this
- ->buildViolation($message, $parameters)
- ->atPath($subPath)
- ->addViolation()
- ;
- }
-
- /**
- * {@inheritdoc}
- */
- public function validate($value, $subPath = '', $groups = null, $traverse = false, $deep = false)
- {
- @trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the '.__CLASS__.'::getValidator() method instead.', E_USER_DEPRECATED);
-
- if (is_array($value)) {
- // The $traverse flag is ignored for arrays
- $constraint = new Valid(array('traverse' => true, 'deep' => $deep));
-
- return $this
- ->getValidator()
- ->inContext($this)
- ->atPath($subPath)
- ->validate($value, $constraint, $groups)
- ;
- }
-
- if ($traverse && $value instanceof \Traversable) {
- $constraint = new Valid(array('traverse' => true, 'deep' => $deep));
-
- return $this
- ->getValidator()
- ->inContext($this)
- ->atPath($subPath)
- ->validate($value, $constraint, $groups)
- ;
- }
-
- return $this
- ->getValidator()
- ->inContext($this)
- ->atPath($subPath)
- ->validate($value, null, $groups)
- ;
- }
-
- /**
- * {@inheritdoc}
- */
- public function validateValue($value, $constraints, $subPath = '', $groups = null)
- {
- @trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the '.__CLASS__.'::getValidator() method instead.', E_USER_DEPRECATED);
-
- return $this
- ->getValidator()
- ->inContext($this)
- ->atPath($subPath)
- ->validate($value, $constraints, $groups)
- ;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getMetadataFactory()
- {
- @trigger_error('The '.__METHOD__.' is deprecated since version 2.5 and will be removed in 3.0. Use the new Symfony\Component\Validator\Context\ExecutionContext::getValidator method in combination with Symfony\Component\Validator\Validator\ValidatorInterface::getMetadataFor or Symfony\Component\Validator\Validator\ValidatorInterface::hasMetadataFor method instead.', E_USER_DEPRECATED);
-
- $validator = $this->getValidator();
-
- if ($validator instanceof LegacyValidatorInterface) {
- return $validator->getMetadataFactory();
- }
-
- // The ValidatorInterface extends from the deprecated MetadataFactoryInterface, so return it when we don't have the factory instance itself
- return $validator;
- }
-