Skip to content

Instantly share code, notes, and snippets.

@ollo-ride-nico
Created January 19, 2018 18:23
Show Gist options
  • Save ollo-ride-nico/2698461f33f2438487f9e838884a35e4 to your computer and use it in GitHub Desktop.
Save ollo-ride-nico/2698461f33f2438487f9e838884a35e4 to your computer and use it in GitHub Desktop.
public function activateAction(Request $request)
{
$params = array();
$token = $request->get('token');
$test = $this->getDoctrine()
->getManager()
->getRepository('App:Utilisateur');
$user = $test->findOneBy(array('token' => $token));
//var_dump($test);
if($user != null) {
$user->setEnabled(true);
$em = $this->getDoctrine()->getManager();
$em->persist($user);
$em->flush();
$params['activate'] = true;
return $this->redirectToRoute('index');
}
else{
$params['activate'] = false;
}
return $params;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment