Traverse.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Validator\Constraints;
  11. use Symfony\Component\Validator\Constraint;
  12. use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
  13. /**
  14. * @Annotation
  15. *
  16. * @since 2.5
  17. *
  18. * @author Bernhard Schussek <bschussek@gmail.com>
  19. */
  20. class Traverse extends Constraint
  21. {
  22. public $traverse = true;
  23. public function __construct($options = null)
  24. {
  25. if (is_array($options) && array_key_exists('groups', $options)) {
  26. throw new ConstraintDefinitionException(sprintf(
  27. 'The option "groups" is not supported by the constraint %s',
  28. __CLASS__
  29. ));
  30. }
  31. parent::__construct($options);
  32. }
  33. /**
  34. * {@inheritdoc}
  35. */
  36. public function getDefaultOption()
  37. {
  38. return 'traverse';
  39. }
  40. /**
  41. * {@inheritdoc}
  42. */
  43. public function getTargets()
  44. {
  45. return self::CLASS_CONSTRAINT;
  46. }
  47. }