Skip to content

Commit

Permalink
Update KeyValueRowType for Symfony 3. May need back-porting to Symfon…
Browse files Browse the repository at this point in the history
…y 2.8
  • Loading branch information
Michael Joyce committed Dec 1, 2016
1 parent c6ad5dc commit 8410577
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 8410577

Please sign in to comment.