From 631111b0c76feeb168f6763fd6966b30c5ec2163 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 10 Oct 2022 16:08:23 +0200 Subject: [PATCH] rename UserCurrentLocationType to more generic Select2UserLocationType NB: used 2 times, check that all works --- src/Bundle/ChillMainBundle/Controller/UserController.php | 4 ++-- .../Select2UserLocationType.php} | 6 +++--- src/Bundle/ChillMainBundle/config/services/form.yaml | 2 +- .../AdministrativeLocationFilter.php | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) rename src/Bundle/ChillMainBundle/Form/{UserCurrentLocationType.php => Type/Select2UserLocationType.php} (94%) diff --git a/src/Bundle/ChillMainBundle/Controller/UserController.php b/src/Bundle/ChillMainBundle/Controller/UserController.php index 9d3941411..03d8d2692 100644 --- a/src/Bundle/ChillMainBundle/Controller/UserController.php +++ b/src/Bundle/ChillMainBundle/Controller/UserController.php @@ -15,7 +15,7 @@ use Chill\MainBundle\CRUD\Controller\CRUDController; use Chill\MainBundle\Entity\GroupCenter; use Chill\MainBundle\Entity\User; use Chill\MainBundle\Form\Type\ComposedGroupCenterType; -use Chill\MainBundle\Form\UserCurrentLocationType; +use Chill\MainBundle\Form\Type\Select2UserLocationType; use Chill\MainBundle\Form\UserPasswordType; use Chill\MainBundle\Form\UserType; use Chill\MainBundle\Pagination\PaginatorInterface; @@ -234,7 +234,7 @@ class UserController extends CRUDController public function editCurrentLocationAction(Request $request) { $user = $this->getUser(); - $form = $this->createForm(UserCurrentLocationType::class, $user) + $form = $this->createForm(Select2UserLocationType::class, $user) ->add('submit', SubmitType::class, ['label' => 'Save']) ->handleRequest($request); diff --git a/src/Bundle/ChillMainBundle/Form/UserCurrentLocationType.php b/src/Bundle/ChillMainBundle/Form/Type/Select2UserLocationType.php similarity index 94% rename from src/Bundle/ChillMainBundle/Form/UserCurrentLocationType.php rename to src/Bundle/ChillMainBundle/Form/Type/Select2UserLocationType.php index a99811bfa..e09b63bac 100644 --- a/src/Bundle/ChillMainBundle/Form/UserCurrentLocationType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Select2UserLocationType.php @@ -9,7 +9,7 @@ declare(strict_types=1); * the LICENSE file that was distributed with this source code. */ -namespace Chill\MainBundle\Form; +namespace Chill\MainBundle\Form\Type; use Chill\MainBundle\Entity\Location; use Chill\MainBundle\Repository\LocationRepository; @@ -21,7 +21,7 @@ use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormView; use Symfony\Component\OptionsResolver\OptionsResolver; -class UserCurrentLocationType extends AbstractType +class Select2UserLocationType extends AbstractType { private LocationRepository $locationRepository; @@ -69,6 +69,6 @@ class UserCurrentLocationType extends AbstractType public function getBlockPrefix() { - return 'user_current_location_type'; + return 'select2_user_location_type'; } } diff --git a/src/Bundle/ChillMainBundle/config/services/form.yaml b/src/Bundle/ChillMainBundle/config/services/form.yaml index 0a757a8db..f047e8f39 100644 --- a/src/Bundle/ChillMainBundle/config/services/form.yaml +++ b/src/Bundle/ChillMainBundle/config/services/form.yaml @@ -132,7 +132,7 @@ services: autowire: true autoconfigure: true - Chill\MainBundle\Form\UserCurrentLocationType: + Chill\MainBundle\Form\Type\Select2UserLocationType: autowire: true autoconfigure: true diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilter.php index b10a66944..9e54a2272 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilter.php @@ -12,7 +12,7 @@ declare(strict_types=1); namespace Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters; use Chill\MainBundle\Export\FilterInterface; -use Chill\MainBundle\Form\UserCurrentLocationType; +use Chill\MainBundle\Form\Type\Select2UserLocationType; use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\PersonBundle\Export\Declarations; use Doctrine\ORM\QueryBuilder; @@ -50,7 +50,7 @@ class AdministrativeLocationFilter implements FilterInterface public function buildForm(FormBuilderInterface $builder) { - $builder->add('accepted_locations', UserCurrentLocationType::class, [ + $builder->add('accepted_locations', Select2UserLocationType::class, [ 'label' => 'Accepted locations', 'label_attr' => [ //'class' => 'd-none'