File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed
src/Symfony/Component/Validator Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -58,24 +58,28 @@ public function loadClassMetadata(ClassMetadata $metadata)
5858 $ metadata ->setGroupSequenceProvider ((bool )$ yaml ['group_sequence_provider ' ]);
5959 }
6060
61- if (isset ($ yaml ['constraints ' ])) {
61+ if (isset ($ yaml ['constraints ' ]) && is_array ( $ yaml [ ' constraints ' ]) ) {
6262 foreach ($ this ->parseNodes ($ yaml ['constraints ' ]) as $ constraint ) {
6363 $ metadata ->addConstraint ($ constraint );
6464 }
6565 }
6666
67- if (isset ($ yaml ['properties ' ])) {
67+ if (isset ($ yaml ['properties ' ]) && is_array ( $ yaml [ ' constraints ' ]) ) {
6868 foreach ($ yaml ['properties ' ] as $ property => $ constraints ) {
69- foreach ($ this ->parseNodes ($ constraints ) as $ constraint ) {
70- $ metadata ->addPropertyConstraint ($ property , $ constraint );
69+ if (null !== $ constraints ) {
70+ foreach ($ this ->parseNodes ($ constraints ) as $ constraint ) {
71+ $ metadata ->addPropertyConstraint ($ property , $ constraint );
72+ }
7173 }
7274 }
7375 }
7476
7577 if (isset ($ yaml ['getters ' ])) {
7678 foreach ($ yaml ['getters ' ] as $ getter => $ constraints ) {
77- foreach ($ this ->parseNodes ($ constraints ) as $ constraint ) {
78- $ metadata ->addGetterConstraint ($ getter , $ constraint );
79+ if (null !== $ constraints ) {
80+ foreach ($ this ->parseNodes ($ constraints ) as $ constraint ) {
81+ $ metadata ->addGetterConstraint ($ getter , $ constraint );
82+ }
7983 }
8084 }
8185 }
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ Symfony\Component\Validator\Tests\Fixtures\Entity:
3535 - Min : 5
3636 # Constraint with options
3737 - Choice : { choices: [A, B], message: Must be one of %choices% }
38+ dummy :
3839
3940 getters :
4041 lastName :
You can’t perform that action at this time.
0 commit comments