From 1b16b8e1daecc02c0b2a7fb8f2172ae9651a39e6 Mon Sep 17 00:00:00 2001 From: nobohan Date: Wed, 4 Apr 2018 10:51:35 +0200 Subject: [PATCH] fix deprecations: set choices_as_values = true + flip content of choices options --- Export/Formatter/CSVFormatter.php | 1 + Form/Type/AppendScopeChoiceTypeTrait.php | 1 + Form/Type/ComposedRoleScopeType.php | 1 + Form/Type/Export/PickFormatterType.php | 2 ++ Form/UserType.php | 8 +++++--- 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Export/Formatter/CSVFormatter.php b/Export/Formatter/CSVFormatter.php index 8b860d07e..c58d24fec 100644 --- a/Export/Formatter/CSVFormatter.php +++ b/Export/Formatter/CSVFormatter.php @@ -26,6 +26,7 @@ use Symfony\Component\Translation\TranslatorInterface; use Symfony\Component\Form\FormBuilderInterface; use Chill\MainBundle\Export\ExportManager; use Symfony\Component\Form\Extension\Core\Type\FormType; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; // command to get the report with curl : curl --user "center a_social:password" "http://localhost:8000/fr/exports/generate/count_person?export[filters][person_gender_filter][enabled]=&export[filters][person_nationality_filter][enabled]=&export[filters][person_nationality_filter][form][nationalities]=&export[aggregators][person_nationality_aggregator][order]=1&export[aggregators][person_nationality_aggregator][form][group_by_level]=country&export[submit]=&export[_token]=RHpjHl389GrK-bd6iY5NsEqrD5UKOTHH40QKE9J1edU" --globoff diff --git a/Form/Type/AppendScopeChoiceTypeTrait.php b/Form/Type/AppendScopeChoiceTypeTrait.php index 14f33f351..77c937645 100644 --- a/Form/Type/AppendScopeChoiceTypeTrait.php +++ b/Form/Type/AppendScopeChoiceTypeTrait.php @@ -31,6 +31,7 @@ use Chill\MainBundle\Entity\User; use Chill\MainBundle\Entity\Center; use Symfony\Component\Security\Core\Role\Role; use Chill\MainBundle\Form\Type\DataTransformer\ScopeTransformer; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; /** * Trait to add an input with reachable scope for a given center and role. diff --git a/Form/Type/ComposedRoleScopeType.php b/Form/Type/ComposedRoleScopeType.php index c7608c6f5..31df765c3 100644 --- a/Form/Type/ComposedRoleScopeType.php +++ b/Form/Type/ComposedRoleScopeType.php @@ -28,6 +28,7 @@ use Chill\MainBundle\Entity\Scope; use Chill\MainBundle\Security\RoleProvider; use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvents; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; /** * Form to Edit/create a role scope. If the role scope does not diff --git a/Form/Type/Export/PickFormatterType.php b/Form/Type/Export/PickFormatterType.php index 92fe29b47..88a0b7ba8 100644 --- a/Form/Type/Export/PickFormatterType.php +++ b/Form/Type/Export/PickFormatterType.php @@ -22,6 +22,8 @@ namespace Chill\MainBundle\Form\Type\Export; 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\Export\ExportManager; /** diff --git a/Form/UserType.php b/Form/UserType.php index d8705aa3e..404461423 100644 --- a/Form/UserType.php +++ b/Form/UserType.php @@ -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. )) ); }