merged branch MaksSlesarenko/added-support-for-propel-enum-types-forms (PR #6715)

This PR was merged into the master branch.

Commits
-------

2a7ecf7 Merge branch 'master' of github:MaksSlesarenko/symfony into added-support-for-propel-enum-types-forms
3ae5b55 added support for propel enum types in PropelTypeGuesser

Discussion
----------

added support for propel enum types in PropelTypeGuesser

added support for propel enum and mysql enum field types

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

by willdurand at 2013-01-14T19:06:06Z

The build status is a Travis-CI issue. Should be green.

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

by MaksSlesarenko at 2013-01-16T23:11:52Z

"The build status is a Travis-CI issue. Should be green."
It definitely should...

PHPUnit 3.7.10 by Sebastian Bergmann.

Configuration read from ../symfony/symfony/src/Symfony/Bridge/Propel1/phpunit.xml.dist

.......................................

Time: 0 seconds, Memory: 8.50Mb

OK (39 tests, 96 assertions)
This commit is contained in:
Fabien Potencier 2013-01-17 07:28:06 +01:00
commit bfbfa337b6

View File

@ -79,7 +79,14 @@ class PropelTypeGuesser implements FormTypeGuesserInterface
case \PropelColumnTypes::BIGINT:
case \PropelColumnTypes::NUMERIC:
return new TypeGuess('integer', array(), Guess::MEDIUM_CONFIDENCE);
case \PropelColumnTypes::ENUM:
case \PropelColumnTypes::CHAR:
if ($column->getValueSet()) {
//check if this is mysql enum
$choices = $column->getValueSet();
$labels = array_map('ucfirst', $choices);
return new TypeGuess('choice', array('choices' => array_combine($choices, $labels)), Guess::MEDIUM_CONFIDENCE);
}
case \PropelColumnTypes::VARCHAR:
return new TypeGuess('text', array(), Guess::MEDIUM_CONFIDENCE);
case \PropelColumnTypes::LONGVARCHAR: