Browse Source

merged branch TonyMalz/VALIDATORT_TYPEGUESS_FIX (PR #4251)

Commits
-------

f883953 TypeGuess fixed for Date/Time constraints
41bed29 [Form] fixed invalid 'type' option in ValidatorTypeGuesser for Date/TimeFields

Discussion
----------

[Form] fixed invalid 'type' option in ValidatorTypeGuesser for Date/TimeFields

Automatic field type guessing breaks, if you use any of the Date/Time
constraints (i.e. Symfony\Component\Validator\Constraints\DateTime), since these field types have no 'type' option defined.
(See getDefaultOptions() in DateTimeType.php)

---------------------------------------------------------------------------

by travisbot at 2012-05-10T15:25:16Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1296309) (merged 005bdbb0 into 68eca0f9).

---------------------------------------------------------------------------

by travisbot at 2012-05-18T15:50:39Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1367774) (merged f8839532 into a04acc89).

---------------------------------------------------------------------------

by TonyMalz at 2012-05-18T15:58:57Z

@bschussek Ok, changed it to 'input'

---------------------------------------------------------------------------

by bschussek at 2012-05-22T08:18:27Z

:+1:
Fabien Potencier 13 years ago
parent
commit
55faa5468b

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

@@ -134,13 +134,13 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface
             case 'Symfony\Component\Validator\Constraints\Date':
                 return new TypeGuess(
                     'date',
-                    array('type' => 'string'),
+                    array('input'=>'string'),
                     Guess::HIGH_CONFIDENCE
                 );
             case 'Symfony\Component\Validator\Constraints\DateTime':
                 return new TypeGuess(
                     'datetime',
-                    array('type' => 'string'),
+                    array('input'=>'string'),
                     Guess::HIGH_CONFIDENCE
                 );
             case 'Symfony\Component\Validator\Constraints\Email':
@@ -212,7 +212,7 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface
             case 'Symfony\Component\Validator\Constraints\Time':
                 return new TypeGuess(
                     'time',
-                    array('type' => 'string'),
+                    array('input'=>'string'),
                     Guess::HIGH_CONFIDENCE
                 );
             case 'Symfony\Component\Validator\Constraints\Url':