From 51a1b23e0d6e5ad160ef80cf49f1a2bb505b6c40 Mon Sep 17 00:00:00 2001 From: nobohan Date: Wed, 4 Apr 2018 11:07:49 +0200 Subject: [PATCH] fix deprecations: use fqcn for entity, ComposedGroupCenterType. --- Controller/UserController.php | 2 +- Form/Type/ComposedGroupCenterType.php | 6 ++++-- Form/Type/ComposedRoleScopeType.php | 11 +++++++---- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Controller/UserController.php b/Controller/UserController.php index 3e4c0c560..c7e06ebd3 100644 --- a/Controller/UserController.php +++ b/Controller/UserController.php @@ -413,7 +413,7 @@ class UserController extends Controller ->setAction($this->generateUrl('admin_user_add_group_center', array('uid' => $user->getId()))) ->setMethod('POST') - ->add(self::FORM_GROUP_CENTER_COMPOSED, new ComposedGroupCenterType()) + ->add(self::FORM_GROUP_CENTER_COMPOSED, ComposedGroupCenterType::class) ->add('submit', SubmitType::class, array('label' => 'Add a new groupCenter')) ->getForm() ; diff --git a/Form/Type/ComposedGroupCenterType.php b/Form/Type/ComposedGroupCenterType.php index a01579737..0fe628401 100644 --- a/Form/Type/ComposedGroupCenterType.php +++ b/Form/Type/ComposedGroupCenterType.php @@ -22,6 +22,8 @@ namespace Chill\MainBundle\Form\Type; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Bridge\Doctrine\Form\Type\EntityType; + use Chill\MainBundle\Entity\PermissionsGroup; use Chill\MainBundle\Entity\Center; @@ -35,12 +37,12 @@ class ComposedGroupCenterType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { - $builder->add('permissionsgroup', 'entity', array( + $builder->add('permissionsgroup', EntityType::class, array( 'class' => 'Chill\MainBundle\Entity\PermissionsGroup', 'choice_label' => function(PermissionsGroup $group) { return $group->getName(); } - ))->add('center', 'entity', array( + ))->add('center', EntityType::class, array( 'class' => 'Chill\MainBundle\Entity\Center', 'choice_label' => function(Center $center) { return $center->getName(); diff --git a/Form/Type/ComposedRoleScopeType.php b/Form/Type/ComposedRoleScopeType.php index 31df765c3..e26edfcfb 100644 --- a/Form/Type/ComposedRoleScopeType.php +++ b/Form/Type/ComposedRoleScopeType.php @@ -23,13 +23,16 @@ namespace Chill\MainBundle\Form\Type; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; -use Chill\MainBundle\Templating\TranslatableStringHelper; -use Chill\MainBundle\Entity\Scope; -use Chill\MainBundle\Security\RoleProvider; +use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvents; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; +use Chill\MainBundle\Templating\TranslatableStringHelper; +use Chill\MainBundle\Entity\Scope; +use Chill\MainBundle\Security\RoleProvider; + + /** * Form to Edit/create a role scope. If the role scope does not * exists in the database, he is generated. @@ -100,7 +103,7 @@ class ComposedRoleScopeType extends AbstractType return $this->roleProvider->getRoleTitle($role); } )) - ->add('scope', 'entity', array( + ->add('scope', EntityType::class, array( 'class' => 'ChillMainBundle:Scope', 'choice_label' => function(Scope $scope) use ($translatableStringHelper) { return $translatableStringHelper->localize($scope->getName());