|
0
|
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 |
|
|
|
16 |
/** |
|
|
17 |
* @Annotation |
|
|
18 |
* |
|
|
19 |
* @api |
|
|
20 |
*/ |
|
|
21 |
class Choice extends Constraint |
|
|
22 |
{ |
|
|
23 |
public $choices; |
|
|
24 |
public $callback; |
|
|
25 |
public $multiple = false; |
|
|
26 |
public $strict = false; |
|
|
27 |
public $min = null; |
|
|
28 |
public $max = null; |
|
|
29 |
public $message = 'The value you selected is not a valid choice'; |
|
|
30 |
public $multipleMessage = 'One or more of the given values is invalid'; |
|
|
31 |
public $minMessage = 'You must select at least {{ limit }} choices'; |
|
|
32 |
public $maxMessage = 'You must select at most {{ limit }} choices'; |
|
|
33 |
|
|
|
34 |
/** |
|
|
35 |
* {@inheritDoc} |
|
|
36 |
*/ |
|
|
37 |
public function getDefaultOption() |
|
|
38 |
{ |
|
|
39 |
return 'choices'; |
|
|
40 |
} |
|
|
41 |
} |