addOption( '--decision-id', null, InputOption::VALUE_REQUIRED, 'ID of the decision to evaluate.' ) ->addOption( '--contact-id', null, InputOption::VALUE_OPTIONAL, 'Evaluate for specific contact' ) ->addOption( '--contact-ids', null, InputOption::VALUE_OPTIONAL, 'CSV of contact IDs to evaluate.' ); parent::configure(); } /** * @throws \Exception */ protected function execute(InputInterface $input, OutputInterface $output): int { defined('MAUTIC_CAMPAIGN_SYSTEM_TRIGGERED') or define('MAUTIC_CAMPAIGN_SYSTEM_TRIGGERED', 1); $decisionId = $input->getOption('decision-id'); $contactId = $input->getOption('contact-id'); if (is_numeric($decisionId)) { $decisionId = (int) $decisionId; } if (is_numeric($contactId)) { $contactId = (int) $contactId; } $contactIds = $this->formatterHelper->simpleCsvToArray($input->getOption('contact-ids'), 'int'); if (!$contactIds && !$contactId) { $output->writeln( "\n". ''.$this->translator->trans('mautic.campaign.trigger.events_executed', ['%count%' => 0]) .'' ); return Command::SUCCESS; } $limiter = new ContactLimiter(null, $contactId, null, null, $contactIds); $counter = $this->inactiveExecution->validate($decisionId, $limiter, $output); $this->writeCounts($output, $this->translator, $counter); return Command::SUCCESS; } }