setDescription('BETA - Get users count') ->addOption('type', null, InputOption::VALUE_REQUIRED, 'type of users count report') ->setHelp( "eg: bin/report count:users --databox_id 2 --email 'admin@alchemy.fr' --dmin '2022-01-01' --dmax '2023-01-01' --type 'added,year,month' \n" . "\type users count report\n" . "- 'added,year' number of newly added user per year\n" . "- 'added,year,month' number of newly added user per year, month\n" ); } /** * @inheritDoc */ protected function getReport(InputInterface $input, OutputInterface $output) { $type = $input->getOption('type'); $this->isAppboxConnection = true; if (!empty($type) && !in_array($type, self::TYPES)) { $output->writeln("wrong '--type' option (--help for available value)"); return 1; } // get just one databox registered to initialize the base class Report $databoxes = $this->container->getDataboxes(); if (count($databoxes) > 0) { $databox = current($databoxes); } else { throw new NotFoundHttpException("NO databox set on this application"); } return new ReportUsers( $databox, [ 'dmin' => $this->dmin, 'dmax' => $this->dmax, 'group' => $type ] ); } }