diff --git a/Form/DoctrineOrmTypeGuesser.php b/Form/DoctrineOrmTypeGuesser.php index 9abe5f5..3a329c3 100644 --- a/Form/DoctrineOrmTypeGuesser.php +++ b/Form/DoctrineOrmTypeGuesser.php @@ -19,13 +19,19 @@ class DoctrineOrmTypeGuesser extends BaseDoctrineOrmTypeGuesser public function guessType($class, $property) { if (!$ret = $this->getMetadata($class)) { - return new TypeGuess('text', [], Guess::LOW_CONFIDENCE); + $type = method_exists('Symfony\Component\Form\AbstractType', 'getBlockPrefix') + ? 'Symfony\Component\Form\Extension\Core\Type\TextType' + : 'text'; + return new TypeGuess($type, [], Guess::LOW_CONFIDENCE); } $metadata = $ret[0]; if ('simple_array' == $metadata->getTypeOfField($property)) { - return new TypeGuess('simple_array', [], Guess::MEDIUM_CONFIDENCE); + $type = method_exists('Symfony\Component\Form\AbstractType', 'getBlockPrefix') + ? 'EmanueleMinotto\SimpleArrayBundle\Form\Type\SimpleArrayType' + : 'simple_array'; + return new TypeGuess($type, [], Guess::MEDIUM_CONFIDENCE); } return parent::guessType($class, $property); diff --git a/Form/Type/SimpleArrayType.php b/Form/Type/SimpleArrayType.php index 145c7fc..535a2da 100644 --- a/Form/Type/SimpleArrayType.php +++ b/Form/Type/SimpleArrayType.php @@ -35,7 +35,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) */ public function getParent() { - return method_exists(__CLASS__, 'getBlockPrefix') + return method_exists('Symfony\Component\Form\AbstractType', 'getBlockPrefix') ? 'Symfony\Component\Form\Extension\Core\Type\TextType' : 'text'; }