@@ 44-61 (lines=18) @@ | ||
41 | ; |
|
42 | } |
|
43 | ||
44 | protected function execute(InputInterface $input, OutputInterface $output) |
|
45 | { |
|
46 | $userClass = $input->getOption('class'); |
|
47 | ||
48 | $repository = $this->getRepository($userClass); |
|
49 | ||
50 | $handler = new CreateUserHandler($repository); |
|
51 | ||
52 | $username = $input->getArgument('username'); |
|
53 | $password = $input->getArgument('password'); |
|
54 | $displayName = $input->getArgument('displayName'); |
|
55 | ||
56 | $command = new CreateUser($username, $password, $displayName); |
|
57 | ||
58 | $handler->handle($command); |
|
59 | ||
60 | $output->writeln($username . ' has been created'); |
|
61 | } |
|
62 | ||
63 | /** |
|
64 | * Get the repository for the user's Class. |
@@ 34-55 (lines=22) @@ | ||
31 | ; |
|
32 | } |
|
33 | ||
34 | protected function execute(InputInterface $input, OutputInterface $output) |
|
35 | { |
|
36 | $userClass = $input->getOption('class'); |
|
37 | ||
38 | $repository = $this->getRepository($userClass); |
|
39 | ||
40 | $handler = new DeleteUserHandler($repository); |
|
41 | ||
42 | $username = $input->getArgument('username'); |
|
43 | $user = $repository->findByUsername($username); |
|
44 | ||
45 | if (!$user) { |
|
46 | $output->writeln('<error>'.$username.' doesn\'t exists'); |
|
47 | exit; |
|
48 | } |
|
49 | ||
50 | $command = new DeleteUser($user); |
|
51 | ||
52 | $handler->handle($command); |
|
53 | ||
54 | $output->writeln($username . ' has been deleted'); |
|
55 | } |
|
56 | ||
57 | /** |
|
58 | * Get the repository for the user's Class. |