Skip to content

Commit

Permalink
Merge pull request #28 from ubermichael/update-for-3-0
Browse files Browse the repository at this point in the history
Update KeyValueRowType for Symfony 3.
  • Loading branch information
Burgov committed Jul 18, 2019
2 parents cbf5c11 + 8410577 commit 7d2b6e6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Form/Type/KeyValueRowType.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
namespace Burgov\Bundle\KeyValueFormBundle\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\ChoiceList\SimpleChoiceList;
use Symfony\Component\Form\ChoiceList\ArrayChoiceList;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
Expand All @@ -15,8 +16,8 @@ public function buildForm(FormBuilderInterface $builder, array $options)
if (null === $options['allowed_keys']) {
$builder->add('key', $options['key_type'], $options['key_options']);
} else {
$builder->add('key', 'choice', array_merge(array(
'choice_list' => new SimpleChoiceList($options['allowed_keys'])
$builder->add('key', ChoiceType::class, array_merge(array(
'choices' => $options['allowed_keys']
), $options['key_options']
));
}
Expand Down

0 comments on commit 7d2b6e6

Please sign in to comment.