diff --git a/src/Command/AddInvitesCommand.php b/src/Command/AddInvitesCommand.php
new file mode 100644
index 0000000..6e59685
--- /dev/null
+++ b/src/Command/AddInvitesCommand.php
@@ -0,0 +1,60 @@
+em = $em;
+ $this->userRepo = $userRepo;
+ $this->inviteManager = $inviteManager;
+ }
+
+ protected function configure()
+ {
+ $this
+ ->setName('invite:add')
+ ->addArgument('username', InputArgument::REQUIRED, 'Username')
+ ->addArgument('number', InputArgument::REQUIRED, 'Number of invites')
+ ;
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ $username = $input->getArgument('username');
+ $number = $input->getArgument('number');
+
+ if (null === $user = $this->userRepo->findOneBy(['username' => $username])) {
+ $output->writeln('User not found.');
+
+ return 1;
+ }
+
+ $this->inviteManager->createInvitesForUser($user, $number);
+
+ $this->em->flush();
+
+ $output->writeln(sprintf('%d invites added to \'%s\'.', $number, $user->getUsername()));
+
+ return 0;
+ }
+}
diff --git a/src/Command/AddUserCommand.php b/src/Command/AddUserCommand.php
index e84536b..7609362 100644
--- a/src/Command/AddUserCommand.php
+++ b/src/Command/AddUserCommand.php
@@ -66,7 +66,7 @@ class AddUserCommand extends Command
}
if (!$password) {
- $output->writeln('User password cannot be empty.');
+ $output->writeln('User password cannot be empty.');
return 1;
}
@@ -86,7 +86,7 @@ class AddUserCommand extends Command
$this->em->flush();
- $output->writeln(sprintf('User \'%s\' registered, %d invites added.', $user->getUsername(), $invites));
+ $output->writeln(sprintf('User \'%s\' registered, %d invites added.', $user->getUsername(), $invites));
return 0;
}