mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
[Syntax Error] line 0, col 32: Error: Expected Doctrine\ORM\Query\Lexer::T_SET, got 'WHERE' #6958
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @yassineMessaoud9 on GitHub (Apr 10, 2022).
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 32: Error: Expected Doctrine\ORM\Query\Lexer::T_SET, got 'WHERE'Repository Method
` public function updateU($password,$email): ?Utilisateur
{
$qb = $this->getEntityManager()
->createQueryBuilder()
->update(Utilisateur::class,'u');
$qb
->where($qb->expr()->eq('u.motpasse',':password'))
->andWhere($qb->expr()->eq('u.email',':email'))
->setParameter('password',$password)
->setParameter('email',$email);
}
`
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()
)
);
}
return $this->render('modifier_mdp/index.html.twig', [
'form' => $form->createView(),
]);
}
`
How can i solve it , And Thanks