private function insertUser(Request $request) { $email = $request->get('email'); $password = $request->get('password'); $user = new User(); $user->setEmail($email); $user->setPassword($this->hasher->hashPassword($password)); $user->setRole(UserRole::ROLE_USER); $this->em->persist($user); $this->em->flush(); }