Improve the TypeGuesser to match the latest Sf2.1
This commit is contained in:
parent
e7470ffebb
commit
cffcdc933f
@ -107,8 +107,17 @@ class PropelTypeGuesser implements FormTypeGuesserInterface
|
|||||||
*/
|
*/
|
||||||
public function guessMaxLength($class, $property)
|
public function guessMaxLength($class, $property)
|
||||||
{
|
{
|
||||||
if (($column = $this->getColumn($class, $property)) && $column->isText()) {
|
if ($column = $this->getColumn($class, $property)) {
|
||||||
return new ValueGuess($column->getSize(), Guess::HIGH_CONFIDENCE);
|
if ($column->isText()) {
|
||||||
|
return new ValueGuess($column->getSize(), Guess::HIGH_CONFIDENCE);
|
||||||
|
}
|
||||||
|
switch ($column->getType()) {
|
||||||
|
case \PropelColumnTypes::FLOAT:
|
||||||
|
case \PropelColumnTypes::REAL:
|
||||||
|
case \PropelColumnTypes::DOUBLE:
|
||||||
|
case \PropelColumnTypes::DECIMAL:
|
||||||
|
return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,6 +126,15 @@ class PropelTypeGuesser implements FormTypeGuesserInterface
|
|||||||
*/
|
*/
|
||||||
public function guessMinLength($class, $property)
|
public function guessMinLength($class, $property)
|
||||||
{
|
{
|
||||||
|
if ($column = $this->getColumn($class, $property)) {
|
||||||
|
switch ($column->getType()) {
|
||||||
|
case \PropelColumnTypes::FLOAT:
|
||||||
|
case \PropelColumnTypes::REAL:
|
||||||
|
case \PropelColumnTypes::DOUBLE:
|
||||||
|
case \PropelColumnTypes::DECIMAL:
|
||||||
|
return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getTable($class)
|
protected function getTable($class)
|
||||||
|
Reference in New Issue
Block a user