/** * newUser * * @param string $email * @param string $password * @return User $user */ public function newUser($email, $password) { $user = new User(); $user->setEmail($email); $user->setPlainPassword($password); $this->em->persist($user); $this->em->flush(); return $user; }
/** * registerUser * * @param array $userData * @return mixed */ public function registerUser(array $userData) { $user = $this->loadUserByEmail($userData['email']); if (!$user) { $user = new User(); $user->setEmail($userData['email']); $user->setPlainPassword($userData['password']); $user->setEnabled(true); $user->setLocked(false); $this->em->persist($user); $this->em->flush(); $this->mailer->sendRegisterUserMail($user, $userData['password']); } return $user; }