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