Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 58 lines (47 sloc) 1.491 kB
c56d28d @fabpot renamed Symfony\Components to Symfony\Component
fabpot authored
1 <?php
2
06fcab5 @fabpot [Validation] fixed license
fabpot authored
3 /*
64e1cf2 @blue-eyes normalized license messages in PHP files
blue-eyes authored
4 * This file is part of the Symfony package.
06fcab5 @fabpot [Validation] fixed license
fabpot authored
5 *
fec10a4 @fabpot replaced symfony-project.org by symfony.com
fabpot authored
6 * (c) Fabien Potencier <fabien@symfony.com>
06fcab5 @fabpot [Validation] fixed license
fabpot authored
7 *
64e1cf2 @blue-eyes normalized license messages in PHP files
blue-eyes authored
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
06fcab5 @fabpot [Validation] fixed license
fabpot authored
10 */
11
64e1cf2 @blue-eyes normalized license messages in PHP files
blue-eyes authored
12 namespace Symfony\Component\Validator\Constraints;
13
e89f91c @vicb [Validation] some tweaks and phpDoc
vicb authored
14 use Symfony\Component\Validator\Constraint;
cd0190c @webmozart [Validator] Improved error messages displayed when the Valid constrai…
webmozart authored
15 use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
e89f91c @vicb [Validation] some tweaks and phpDoc
vicb authored
16
be4f2a0 @fabpot [Validator] tagged the public @api
fabpot authored
17 /**
18 * @Annotation
19 *
20 * @api
21 */
e89f91c @vicb [Validation] some tweaks and phpDoc
vicb authored
22 class All extends Constraint
c56d28d @fabpot renamed Symfony\Components to Symfony\Component
fabpot authored
23 {
24 public $constraints = array();
25
cd0190c @webmozart [Validator] Improved error messages displayed when the Valid constrai…
webmozart authored
26 /**
27 * {@inheritDoc}
28 */
29 public function __construct($options = null)
30 {
31 parent::__construct($options);
32
33 if (!is_array($this->constraints)) {
34 $this->constraints = array($this->constraints);
35 }
36
37 foreach ($this->constraints as $constraint) {
38 if (!$constraint instanceof Constraint) {
39 throw new ConstraintDefinitionException('The value ' . $constraint . ' is not an instance of Constraint in constraint ' . __CLASS__);
40 }
41
42 if ($constraint instanceof Valid) {
43 throw new ConstraintDefinitionException('The constraint Valid cannot be nested inside constraint ' . __CLASS__ . '. You can only declare the Valid constraint directly on a field or method.');
44 }
45 }
46 }
47
f69e630 @fabpot [Validator] renamed methods that do not follow CS
fabpot authored
48 public function getDefaultOption()
c56d28d @fabpot renamed Symfony\Components to Symfony\Component
fabpot authored
49 {
50 return 'constraints';
51 }
52
f69e630 @fabpot [Validator] renamed methods that do not follow CS
fabpot authored
53 public function getRequiredOptions()
c56d28d @fabpot renamed Symfony\Components to Symfony\Component
fabpot authored
54 {
55 return array('constraints');
56 }
2d8d332 @fabpot fixed CS
fabpot authored
57 }
Something went wrong with that request. Please try again.