diff --git a/src/Command/TeamerStatusCommand.php b/src/Command/TeamerStatusCommand.php
index 22c2471..9014288 100644
--- a/src/Command/TeamerStatusCommand.php
+++ b/src/Command/TeamerStatusCommand.php
@@ -11,6 +11,7 @@ use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
#[AsCommand(name: 'app:teamer-status', description: 'Updates status of teamers depending on their disposition')]
@@ -23,8 +24,60 @@ class TeamerStatusCommand extends Command
parent::__construct();
}
+ /**
+ * Configures the command options.
+ */
+ protected function configure(): void
+ {
+ $this
+ ->addOption(
+ 'force',
+ 'f',
+ InputOption::VALUE_NONE,
+ 'Force execution regardless of date restrictions'
+ )
+ ->addOption(
+ 'allowed-date',
+ null,
+ InputOption::VALUE_REQUIRED,
+ 'Date when command is allowed to run (format: MM-DD)',
+ '05-01'
+ )
+ ;
+ }
+
+ /**
+ * Executes the teamer status update command.
+ *
+ * Checks if current date matches the allowed date (or --force is used), then finds all
+ * teamers with NEW status who have COMPLETED dispositions and updates
+ * their status to EXISTING. This reflects their transition from new to
+ * experienced team members.
+ */
protected function execute(InputInterface $input, OutputInterface $output): int
{
+ $currentDate = new \DateTimeImmutable();
+ $force = $input->getOption('force');
+ $allowedDate = $input->getOption('allowed-date');
+
+ // Parse and validate allowed date
+ if (false === preg_match('/^(\d{2})-(\d{2})$/', $allowedDate, $matches)) {
+ $output->writeln('Invalid allowed-date format. Use MM-DD format (e.g., 05-01)');
+
+ return Command::FAILURE;
+ }
+
+ $allowedMonth = (int) $matches[1];
+ $allowedDay = (int) $matches[2];
+
+ // Early exit if not the allowed date and not forced
+ if (false === $force && ($allowedMonth !== (int) $currentDate->format('n') || $allowedDay !== (int) $currentDate->format('j'))) {
+ $output->writeln('Command only runs on '.$allowedDate.'. Use --force to override this restriction.');
+
+ return Command::SUCCESS;
+ }
+
+ // Find teamers with NEW status who have completed dispositions
$qb = $this
->entityManager
->getRepository(Teamer::class)
@@ -54,6 +107,7 @@ class TeamerStatusCommand extends Command
return Command::SUCCESS;
}
+ // Update status for all eligible teamers
foreach ($teamersToUpdate as $teamer) {
$teamer->setStatus(Teamer::STATUS_EXISTING);
}