Преглед изворни кода

[Form] removed guesser for Choice constraints

The guesser has been removed as the constraints only knows
about the valid keys. But to be able to create the Type automatically,
we also need the values.
Fabien Potencier пре 14 година
родитељ
комит
47da6cf39e
2 измењених фајлова са 3 додато и 11 уклоњено
  1. 3 0
      UPDATE.md
  2. 0 11
      src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php

+ 3 - 0
UPDATE.md

@@ -9,6 +9,9 @@ timeline closely anyway.
 RC4 to RC5
 ----------
 
+* Removed the guesser for the Choice constraint as the constraint only knows
+  about the valid keys, and not their values.
+
 * To avoid security issues, HTTP headers coming from proxies are not trusted
   anymore by default (like `HTTP_X_FORWARDED_FOR`, `X_FORWARDED_PROTO`, and
   `X_FORWARDED_HOST`). If your application is behind a reverse proxy, add the

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

@@ -124,17 +124,6 @@ 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),
-                    Guess::HIGH_CONFIDENCE
-                );
             case 'Symfony\Component\Validator\Constraints\Country':
                 return new TypeGuess(
                     'country',