addArgument('email', InputArgument::REQUIRED, 'The email of the user thats claims the season') ->addArgument('season', InputArgument::REQUIRED, 'The season to claim') ; } protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); $email = $input->getArgument('email'); $seasonCode = $input->getArgument('season'); try { $season = $this->seasonRepository->findOneBy(['seasonCode' => $seasonCode]); if (null === $season) { throw new \InvalidArgumentException('Season not found'); } $user = $this->userRepository->findOneBy(['email' => $email]); if (null === $user) { throw new \InvalidArgumentException('User not found'); } $season->addOwner($user); $this->entityManager->flush(); } catch (\InvalidArgumentException $invalidArgumentException) { $io->error($invalidArgumentException->getMessage()); return Command::FAILURE; } return Command::SUCCESS; } }