Bläddra i källkod

[Form] fixed guesser when a choice constraint is defined via a callback

Fabien Potencier 14 år sedan
förälder
incheckning
a724774fc0

+ 5 - 0
src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php

@@ -125,6 +125,11 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface
                 }
                 break;
             case 'Symfony\Component\Validator\Constraints\Choice':
+                if (!$constraint->choices) {
+                    // choices probably defined as a callback
+                    break;
+                }
+
                 return new TypeGuess(
                     'choice',
                     array('choices' => $constraint->choices),