Skip to content

Commit

Permalink
fixed some deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
EmanueleMinotto committed Nov 19, 2016
1 parent 9834c3a commit 0c03c85
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions Form/DoctrineOrmTypeGuesser.php
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Form/Type/SimpleArrayType.php
Expand Up @@ -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';
}
Expand Down

0 comments on commit 0c03c85

Please sign in to comment.