From 47da6cf39eeda97ec46e899704115b222e66a151 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 6 Jul 2011 14:31:52 +0200 Subject: [PATCH] [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. --- UPDATE.md | 3 +++ .../Form/Extension/Validator/ValidatorTypeGuesser.php | 11 ----------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/UPDATE.md b/UPDATE.md index e9054c67d4..0923934e91 100644 --- a/UPDATE.md +++ b/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 diff --git a/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php b/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php index abc7f57954..955d1a9637 100644 --- a/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php +++ b/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',