fix deprecations: set choices_as_values = true + flip content of choices options

This commit is contained in:
nobohan
2018-04-04 10:51:35 +02:00
parent 56a695e66e
commit 1b16b8e1da
5 changed files with 10 additions and 3 deletions

View File

@@ -6,6 +6,7 @@ use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Chill\MainBundle\Form\UserPasswordType;
class UserType extends AbstractType
@@ -28,11 +29,12 @@ class UserType extends AbstractType
$builder->add($builder
->create('enabled', ChoiceType::class, array(
'choices' => array(
0 => 'Disabled, the user is not allowed to login',
1 => 'Enabled, the user is active'
'Disabled, the user is not allowed to login' => 0,
'Enabled, the user is active' => 1
),
'expanded' => false,
'multiple' => false
'multiple' => false,
'choices_as_values' => true // Can be removed when upgraded to Sf3.
))
);
}