Skip to content

Commit b6e61ca

Browse files
committed
tweaks for 2.7
1 parent 82d465a commit b6e61ca

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

cookbook/doctrine/registration_form.rst

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,8 @@ controller for displaying the registration form::
224224
$form->handleRequest($request);
225225
if ($form->isValid() && $form->isSubmitted()) {
226226
// 3) Encode the password (you could also do this via Doctrine listener)
227-
$encoder = $this->get('security.encoder_factory')
228-
->getEncoder($user);
229-
$password = $encoder->encodePassword($user->getPlainPassword(), $user->getSalt());
227+
$password = $this->get('security.password_encoder')
228+
->encodePassword($user, $user->getPlainPassword());
230229
$user->setPassword($password);
231230

232231
// 4) save the User!
@@ -237,9 +236,7 @@ controller for displaying the registration form::
237236
// ... do any other work - like send them an email, etc
238237
// maybe set a "flash" success message for the user
239238

240-
$redirectUrl = $this->generateUrl('replace_with_some_route');
241-
242-
return $this->redirect($redirectUrl);
239+
return $this->redirectToRoute('replace_with_some_route');
243240
}
244241

245242
return $this->render(

0 commit comments

Comments
 (0)