title("Création d'un utilisateur administrateur"); $userExit = $this->entityManager->getRepository(Account::class)->findOneBy(['email'=>'jovann@siteconseil.fr']); if(!$userExit instanceof Account) { $password = TempPasswordGenerator::generate(); $userExit = new Account(); $userExit->setRoles(['ROLE_ROOT']); $userExit->setUuid(Uuid::v4()); $userExit->setIsFirstLogin(true); $questionEmail = new Question("Email ?"); $email = $io->askQuestion($questionEmail); $userExit->setEmail($email); $questionUsername = new Question("Username ?"); $username = $io->askQuestion($questionUsername); $userExit->setUsername($username); $userExit->setPassword($this->userPasswordHasher->hashPassword($userExit, $password)); $this->entityManager->persist($usserExit); $this->entityManager->flush(); $this->eventDispatcher->dispatch(new CreatedAdminEvent($userExit, $password)); } return Command::SUCCESS; } }