fix deprecations: add choices_as_values=true + flip contents of choice in ChoiceType

This commit is contained in:
nobohan 2018-04-04 22:00:37 +02:00
parent fac8506893
commit 9cd32cb59c
5 changed files with 7 additions and 3 deletions

View File

@ -122,6 +122,7 @@ class CSVFormatter implements FormatterInterface
range(1, $nbAggregators), range(1, $nbAggregators),
range(1, $nbAggregators) range(1, $nbAggregators)
), ),
'choices_as_values' => true,
'multiple' => false, 'multiple' => false,
'expanded' => false 'expanded' => false
)); ));

View File

@ -194,6 +194,7 @@ class SpreadSheetFormatter implements FormatterInterface
range(1, $nbAggregators), range(1, $nbAggregators),
range(1, $nbAggregators) range(1, $nbAggregators)
), ),
'choices_as_values' => true,
'multiple' => false, 'multiple' => false,
'expanded' => false 'expanded' => false
)); ));

View File

@ -121,7 +121,8 @@ trait AppendScopeChoiceTypeTrait
$form->add( $form->add(
$builder $builder
->create($name, ChoiceType::class, array( ->create($name, ChoiceType::class, array(
'choices' => $choices, 'choices' => array_combine(array_values($choices),array_keys($choices)),
'choices_as_values' => true,
'auto_initialize' => false 'auto_initialize' => false
) )
) )

View File

@ -90,7 +90,8 @@ class ComposedRoleScopeType extends AbstractType
$builder $builder
->add('role', ChoiceType::class, array( ->add('role', ChoiceType::class, array(
'choices' => $values, 'choices' => array_combine(array_values($values),array_keys($values)),
'choices_as_values' => true,
'placeholder' => 'Choose amongst roles', 'placeholder' => 'Choose amongst roles',
'choice_attr' => function($role) use ($rolesWithoutScopes) { 'choice_attr' => function($role) use ($rolesWithoutScopes) {
if (in_array($role, $rolesWithoutScopes)) { if (in_array($role, $rolesWithoutScopes)) {

View File

@ -54,7 +54,7 @@ class PickFormatterType extends AbstractType
} }
$builder->add('alias', ChoiceType::class, array( $builder->add('alias', ChoiceType::class, array(
'choices' => $choices, 'choices' => array_combine(array_values($choices),array_keys($choices)),
'choices_as_values' => true, 'choices_as_values' => true,
'multiple' => false 'multiple' => false
)); ));