浏览代码

Remplacement des FormFactory de suppression

François Drouhard 3 年之前
父节点
当前提交
81cb9df77b

+ 3 - 2
src/Controller/GenreController.php

@@ -8,6 +8,7 @@ use App\Repository\FilmRepository;
 use App\Repository\GenreRepository;
 use App\Service\GenreManager;
 use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
+use Symfony\Component\Form\FormFactoryInterface;
 use Symfony\Component\Routing\Annotation\Route;
 use Symfony\Component\HttpFoundation\Request;
 
@@ -72,9 +73,9 @@ class GenreController extends AbstractController
 	/**
 	 * @Route("/genre/supprimer/{id}", name="genre_supprimer")
 	 */
-	public function supprimerAction(Request $request, Genre $genre, GenreManager $genreManager)
+	public function supprimerAction(Request $request, Genre $genre, GenreManager $genreManager, FormFactoryInterface $ffi)
     {
-        $form = $this->get('form.factory')->create();
+        $form = $ffi->create();
         $form->handleRequest($request);
         if ($form->isSubmitted() && $form->isValid())
         {

+ 1 - 0
src/Controller/ProfilController.php

@@ -2,6 +2,7 @@
 
 namespace App\Controller;
 
+use App\Entity\User;
 use Doctrine\ORM\EntityManagerInterface;
 use App\Form\UserEditProfilType;
 use App\Form\ProfileType;

+ 3 - 2
src/Controller/RealisateurController.php

@@ -8,6 +8,7 @@ use App\Repository\RealisateurRepository;
 use App\Service\RealisateurManager;
 use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
 use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
+use Symfony\Component\Form\FormFactoryInterface;
 use Symfony\Component\Routing\Annotation\Route;
 use Symfony\Component\HttpFoundation\Request;
 
@@ -70,9 +71,9 @@ class RealisateurController extends AbstractController
 	 * @Route("/real/supprimer/{id}", name="realisateur_supprimer")
      * @IsGranted("ROLE_ADMIN")
 	 */
-	public function supprimerAction(Request $request, Realisateur $realisateur, RealisateurManager $realisateurManager)
+	public function supprimerAction(Request $request, Realisateur $realisateur, RealisateurManager $realisateurManager, FormFactoryInterface $ffi)
     {
-        $form = $this->get('form.factory')->create();
+		$form = $ffi->create();
         $form->handleRequest($request);
         if ($form->isSubmitted() && $form->isValid())
         {

+ 3 - 2
src/Controller/SecurityController.php

@@ -18,6 +18,7 @@ use App\Entity\User;
 use App\Form\ProfileType;
 use App\Repository\UserRepository;
 use Doctrine\ORM\EntityManagerInterface;
+use Symfony\Component\Form\FormFactoryInterface;
 use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
 use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
 use Symfony\Component\HttpFoundation\Response;
@@ -120,9 +121,9 @@ class SecurityController extends AbstractController
     /**
      * @Route("/admin/deluser/{id}", name="admin_deluser")
      */
-    public function delUserAction (Request $request, User $user, UserManager $userManager)
+    public function delUserAction (Request $request, User $user, UserManager $userManager, FormFactoryInterface $ffi)
     {
-        $form = $this->get('form.factory')->create();
+        $form = $ffi->create();
         $form->handleRequest($request);
         if ($form->isSubmitted() && $form->isValid()) {
             $userManager->removeUser($user);

+ 3 - 2
src/Controller/VideothequeController.php

@@ -20,6 +20,7 @@ use App\Repository\RealisateurRepository;
 use App\Service\CommentaireManager;
 use App\Service\FilmManager;
 use App\Service\OptionsManager;
+use Symfony\Component\Form\FormFactoryInterface;
 
 class VideothequeController extends AbstractController
 {
@@ -119,9 +120,9 @@ class VideothequeController extends AbstractController
 	 * @Route("/supprimer/{id}", name="videotheque_supprimer")
      * @IsGranted("ROLE_ADMIN")
 	 */
-	public function supprimerAction(Request $request, Film $film, FilmManager $filmManager)
+	public function supprimerAction(Request $request, Film $film, FilmManager $filmManager, FormFactoryInterface $ffi)
 	{
-        $form = $this->get('form.factory')->create();
+        $form = $ffi->create();
         $form->handleRequest($request);
         if ($form->isSubmitted() && $form->isValid())
         {