use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Constraints\Traverse;
use Symfony\Component\Validator\Constraints\Valid;
-use Symfony\Component\Validator\Exception\BadMethodCallException;
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
-use Symfony\Component\Validator\ValidationVisitorInterface;
/**
* A generic container of {@link Constraint} objects.
*
* If the constraint {@link Valid} is added, the cascading strategy will be
* changed to {@link CascadingStrategy::CASCADE}. Depending on the
- * properties $traverse and $deep of that constraint, the traversal strategy
+ * $traverse property of that constraint, the traversal strategy
* will be set to one of the following:
*
- * - {@link TraversalStrategy::IMPLICIT} if $traverse is enabled and $deep
- * is enabled
- * - {@link TraversalStrategy::IMPLICIT} | {@link TraversalStrategy::STOP_RECURSION}
- * if $traverse is enabled, but $deep is disabled
+ * - {@link TraversalStrategy::IMPLICIT} if $traverse is enabled
* - {@link TraversalStrategy::NONE} if $traverse is disabled
*
- * @param Constraint $constraint The constraint to add
- *
* @return $this
*
* @throws ConstraintDefinitionException When trying to add the
));
}
- if ($constraint instanceof Valid) {
+ if ($constraint instanceof Valid && null === $constraint->groups) {
$this->cascadingStrategy = CascadingStrategy::CASCADE;
if ($constraint->traverse) {
- // Traverse unless the value is not traversable
$this->traversalStrategy = TraversalStrategy::IMPLICIT;
-
- if (!$constraint->deep) {
- $this->traversalStrategy |= TraversalStrategy::STOP_RECURSION;
- }
} else {
$this->traversalStrategy = TraversalStrategy::NONE;
}
{
return $this->traversalStrategy;
}
-
- /**
- * Exists for compatibility with the deprecated
- * {@link Symfony\Component\Validator\MetadataInterface}.
- *
- * Should not be used.
- *
- * Implemented for backward compatibility with Symfony < 2.5.
- *
- * @throws BadMethodCallException
- *
- * @deprecated since version 2.5, to be removed in 3.0.
- */
- public function accept(ValidationVisitorInterface $visitor, $value, $group, $propertyPath)
- {
- throw new BadMethodCallException('Not supported.');
- }
}