Explorar o código

Deprecated getRepository

François Drouhard %!s(int64=2) %!d(string=hai) anos
pai
achega
fcd59f007d
Modificáronse 1 ficheiros con 4 adicións e 4 borrados
  1. 4 4
      src/Controller/SecurityController.php

+ 4 - 4
src/Controller/SecurityController.php

@@ -164,7 +164,7 @@ class SecurityController extends AbstractController
     /**
      * @Route("/motdepasseoublie", name="security_envoyertoken")
      */
-    public function recupMdpAction(Request $request, UserManager $userManager, Mail $mail, EntityManagerInterface $em)
+    public function recupMdpAction(Request $request, UserManager $userManager, Mail $mail, EntityManagerInterface $em, UserRepository $userRepo)
     {
         $form = $this->createFormBuilder()
             ->add('email', EmailType::class)
@@ -174,7 +174,7 @@ class SecurityController extends AbstractController
         $form->handleRequest($request);
         if ($form->isSubmitted() && $form->isValid()) {
             $data = $form->getData();
-            $user = $em->getRepository('App:User')->findOneBy(array('mail'=>$data['email']));
+            $user = $userRepo->findOneBy(array('mail'=>$data['email']));
             if ($user != null)
             {
                 $userManager->generateToken($user);
@@ -222,9 +222,9 @@ class SecurityController extends AbstractController
      * Ne pas utiliser
      * @Route("/admin/resettokens", name="admin_resettokens")
      */
-    public function resetTokensAction(UserManager $userManager, EntityManagerInterface $em)
+    public function resetTokensAction(UserManager $userManager, EntityManagerInterface $em, UserRepository $userRepo)
     {
-        $users = $em->getRepository('App:User')->findAll();
+        $users = $userRepo->findAll();
         foreach ($users as $user)
         {
             $userManager->generateToken($user);