diff --git a/book/security.rst b/book/security.rst index 6942b426965..49e9be8622b 100644 --- a/book/security.rst +++ b/book/security.rst @@ -1175,8 +1175,8 @@ in the following way from a controller:: // whatever *your* User object is $user = new AppBundle\Entity\User(); $plainPassword = 'ryanpass'; - $encoded = $this->container->get('security.password_encoder') - ->encodePassword($user, $plainPassword); + $encoder = $this->container->get('security.password_encoder'); + $encoded = $encoder->encodePassword($user, $plainPassword); $user->setPassword($encoded);