소스 검색

[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',