public function initializePassword(User $user) { $user->setHashTime(time()); $password = sha1(rand(1000, 10000) . $user->getUsername() . $user->getSalt()); $user->setResetPasswordHash($password); $this->objectManager->persist($user); $this->objectManager->flush(); }