| @@ 35-50 (lines=16) @@ | ||
| 32 | ; |
|
| 33 | } |
|
| 34 | ||
| 35 | protected function execute(InputInterface $input, OutputInterface $output) |
|
| 36 | { |
|
| 37 | $repository = $this->getContainer()->get('multi_user.user.repository'); |
|
| 38 | ||
| 39 | $handler = new CreateUserHandler($repository); |
|
| 40 | ||
| 41 | $username = $input->getArgument('username'); |
|
| 42 | $password = $input->getArgument('password'); |
|
| 43 | $displayName = $input->getArgument('displayName'); |
|
| 44 | ||
| 45 | $command = new CreateUser($username, $password, $displayName); |
|
| 46 | ||
| 47 | $handler->handle($command); |
|
| 48 | ||
| 49 | $output->writeln($username . ' has been created'); |
|
| 50 | } |
|
| 51 | } |
|
| 52 | ||
| @@ 25-44 (lines=20) @@ | ||
| 22 | ; |
|
| 23 | } |
|
| 24 | ||
| 25 | protected function execute(InputInterface $input, OutputInterface $output) |
|
| 26 | { |
|
| 27 | $repository = $this->getContainer()->get('multi_user.user.repository'); |
|
| 28 | ||
| 29 | $handler = new DeleteUserHandler($repository); |
|
| 30 | ||
| 31 | $username = $input->getArgument('username'); |
|
| 32 | $user = $repository->findByUsername($username); |
|
| 33 | ||
| 34 | if (!$user) { |
|
| 35 | $output->writeln('<error>'.$username.' doesn\'t exists'); |
|
| 36 | exit; |
|
| 37 | } |
|
| 38 | ||
| 39 | $command = new DeleteUser($user); |
|
| 40 | ||
| 41 | $handler->handle($command); |
|
| 42 | ||
| 43 | $output->writeln($username . ' has been deleted'); |
|
| 44 | } |
|
| 45 | } |
|
| 46 | ||