Partage
  • Partager sur Facebook
  • Partager sur Twitter

Syntax Error line 0, col 73: Error: Expected

[Syntax Error] line 0, col 73: Error: Expected =, <, <=, <>, >, >=, !=

    10 avril 2022 à 3:16:08

    I am using a Symfony 4 project, and I want to change the user password, so I created a method in my repository and called it to the controller, but this error it diplay to me,

    [Syntax Error] line 0, col 73: Error: Expected =, <, <=, <>, >, >=, !=, got 'AND'
    



    Repository Method
    public function updateU($password,$email): ?Utilisateur
    {
        $result= $this->getEntityManager()
                      ->createQueryBuilder()
                      ->update(Utilisateur::class,'u')
                      ->set('u.password',':password')
                      ->where('u.email',':email')
                      ->setParameter('password',$password)
                      ->setParameter('email',$email)
                      ->getQuery()
                      ->getSingleScalarResult();  
        return $result;
    
    }
    
    Controller Method
    /**
     * @Route("/Reset", name="Reset")
     * Method({"GET"})
     */
    public function New(
        Request $request,
        UtilisateurRepository $URe,
        UserPasswordEncoderInterface $userPasswordEncoder,
        EntityManagerInterface $entityManager,
        MailerInterface $mailer
    ) {
        $o = '';
        $Varmail = $_GET['email'];
    
        $user = new Utilisateur($o);
        $form = $this->createFormBuilder($user)
            ->add('password', PasswordType::class)
            ->getForm();
        $form->handleRequest($request);
        if ($form->isSubmitted() && $form->isValid()) {
            $to = $Varmail;
            $sujet = 'Password Changed';
            $Message = "Bonjour $Varmail Votre password est changé !";
            $pass = $user->setPassword(
                $userPasswordEncoder->encodePassword(
                    $user,
                    $form->get('password')->getData()
                )
            );
    
            $URe->updateU($pass, $Varmail);
    
            $Mai = new MailerController();
            $Mai->sendEmail($mailer, $to, $sujet, $Message);
        }
        return $this->render('modifier_mdp/index.html.twig', [
            'form' => $form->createView(),
        ]);
    }
    


    How can i solve it , And Thanks

    -
    Edité par medyassinemessaoud1 10 avril 2022 à 3:16:54

    • Partager sur Facebook
    • Partager sur Twitter

    Syntax Error line 0, col 73: Error: Expected

    × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
    × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
    • Editeur
    • Markdown