Răsfoiți Sursa

Héritage du formulaire UserType par UserEditType

François 6 ani în urmă
părinte
comite
3da9eadfc2
2 a modificat fișierele cu 3 adăugiri și 31 ștergeri
  1. 0 3
      app/Resources/views/base.html.twig
  2. 3 28
      src/AppBundle/Form/UserEditType.php

+ 0 - 3
app/Resources/views/base.html.twig

@@ -41,8 +41,6 @@
 				<h1>{% block titre %}{% endblock %}</h1>
 			</header>
 			<main role="main">
-
-
 				{#<nav class="col-md-2">
 					<ul class="nav flex-column">
 						<li class="nav-item"><a class="nav-link" href="{{  path('videotheque_liste') }}">Liste des films</a></li>
@@ -65,7 +63,6 @@
 
 			</main>
 
-
 			<footer>
 				{% block footer %}
 				{% endblock %}

+ 3 - 28
src/AppBundle/Form/UserEditType.php

@@ -3,8 +3,6 @@
 namespace AppBundle\Form;
 
 use Symfony\Component\Form\AbstractType;
-use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
-use Symfony\Component\Form\Extension\Core\Type\SubmitType;
 use Symfony\Component\Form\FormBuilderInterface;
 use Symfony\Component\OptionsResolver\OptionsResolver;
 
@@ -16,37 +14,14 @@ class UserEditType extends AbstractType
     public function buildForm(FormBuilderInterface $builder, array $options)
     {
         $builder
-            ->add('username')
-            ->add('roles', ChoiceType::class, array(
-                'choices'   => array (
-                    'Administrateur'    =>  'ROLE_ADMIN',
-                    'User'     =>  'ROLE_USER',
-                    'Modérateur'   =>  'ROLE_MODERATEUR',
-                    'Super Admin'   =>  'ROLE_SUPER_ADMIN'
-                ),
-                'multiple'  => true
-            ))
-            ->add('save', SubmitType::class, array('label' => 'Enregistrer'));
-
+            ->remove('password');
     }
 
-    /**
-     * {@inheritdoc}
-     */
-    public function configureOptions(OptionsResolver $resolver)
+    public function getParent()
     {
-        $resolver->setDefaults(array(
-            'data_class' => 'AppBundle\Entity\User'
-        ));
+        return UserType::class;
     }
 
-    /**
-     * {@inheritdoc}
-     */
-    public function getBlockPrefix()
-    {
-        return 'appbundle_user';
-    }
 
 
 }