Traverse.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. * @author Bernhard Schussek <bschussek@gmail.com>
  17. */
  18. class Traverse extends Constraint
  19. {
  20. public $traverse = true;
  21. public function __construct($options = null)
  22. {
  23. if (\is_array($options) && array_key_exists('groups', $options)) {
  24. throw new ConstraintDefinitionException(sprintf('The option "groups" is not supported by the constraint %s', __CLASS__));
  25. }
  26. parent::__construct($options);
  27. }
  28. /**
  29. * {@inheritdoc}
  30. */
  31. public function getDefaultOption()
  32. {
  33. return 'traverse';
  34. }
  35. /**
  36. * {@inheritdoc}
  37. */
  38. public function getTargets()
  39. {
  40. return self::CLASS_CONSTRAINT;
  41. }
  42. }