[DoctrineBridge][Form] added collection guess for array Doctrine type and array constraint type

Fixes #1692
This commit is contained in:
pierre 2012-04-14 13:50:58 +02:00
parent 83a0edd24b
commit 8bdff01f17
3 changed files with 6 additions and 2 deletions

View File

@ -14,6 +14,7 @@ To get the diff between two versions, go to https://github.com/symfony/symfony/c
* added a default implementation of the ManagerRegistry
* added a session storage for Doctrine DBAL
* DoctrineOrmTypeGuesser now guesses "collection" for array Doctrine type
### TwigBridge
@ -273,6 +274,7 @@ To get the diff between two versions, go to https://github.com/symfony/symfony/c
* deprecated FieldType and merged it into FormType
* [BC BREAK] renamed "field_*" theme blocks to "form_*" and "field_widget" to
"input"
* ValidatorTypeGuesser now guesses "collection" for array type constraint
### HttpFoundation

View File

@ -50,8 +50,8 @@ class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface
switch ($metadata->getTypeOfField($property))
{
//case 'array':
// return new TypeGuess('Collection', array(), Guess::HIGH_CONFIDENCE);
case 'array':
return new TypeGuess('collection', array(), Guess::MEDIUM_CONFIDENCE);
case 'boolean':
return new TypeGuess('checkbox', array(), Guess::HIGH_CONFIDENCE);
case 'datetime':

View File

@ -89,6 +89,8 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface
switch (get_class($constraint)) {
case 'Symfony\Component\Validator\Constraints\Type':
switch ($constraint->type) {
case 'array':
return new TypeGuess('collection', array(), Guess::MEDIUM_CONFIDENCE);
case 'boolean':
case 'bool':
return new TypeGuess('checkbox', array(), Guess::MEDIUM_CONFIDENCE);