Loading module/Administration/src/Command/CalculTableauxBordCommand.php +39 −13 Original line number Diff line number Diff line Loading @@ -4,7 +4,9 @@ namespace Administration\Command; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Helper\ProgressBar; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; use UnicaenTbl\Event; Loading @@ -21,23 +23,46 @@ class CalculTableauxBordCommand extends Command private ProgressBar $progressBar; protected function configure(): void { $this->setDescription('Calcul des tableaux de bord'); $this->setDescription('Calcul des tableaux de bord') ->addArgument('tableau-bord', InputArgument::OPTIONAL, 'Tableau de bord à calculer (si pas précisé, tous se recalculeront') ->addOption('annee', 'a', InputOption::VALUE_OPTIONAL, 'ID Année') ->addOption('intervenant', 'i', InputOption::VALUE_OPTIONAL, 'ID Intervenant'); } protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); $io->title($this->getDescription()); $tableauBord = $input->getArgument('tableau-bord'); $anneeId = $input->getOption('annee'); $intervenantId = $input->getOption('intervenant'); $this->progressBar = $io->createProgressBar(0); $this->getServiceTableauBord()->setOnAction(function (Event $event) use ($io) { $this->onEvent($event, $io); }); if ($tableauBord) { $params = []; if ($anneeId) { $params['ANNEE_ID'] = (int)$anneeId; } if ($intervenantId){ $params['INTERVENANT_ID'] = (int)$intervenantId; } $this->getServiceTableauBord()->calculer($tableauBord, $params); return Command::SUCCESS; }else{ $result = $this->getServiceTableauBord()->calculerTout(['formule']); $io->comment('Fin du calcul des tableaux de bord'); Loading @@ -49,6 +74,7 @@ class CalculTableauxBordCommand extends Command return Command::FAILURE; } } } Loading Loading
module/Administration/src/Command/CalculTableauxBordCommand.php +39 −13 Original line number Diff line number Diff line Loading @@ -4,7 +4,9 @@ namespace Administration\Command; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Helper\ProgressBar; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; use UnicaenTbl\Event; Loading @@ -21,23 +23,46 @@ class CalculTableauxBordCommand extends Command private ProgressBar $progressBar; protected function configure(): void { $this->setDescription('Calcul des tableaux de bord'); $this->setDescription('Calcul des tableaux de bord') ->addArgument('tableau-bord', InputArgument::OPTIONAL, 'Tableau de bord à calculer (si pas précisé, tous se recalculeront') ->addOption('annee', 'a', InputOption::VALUE_OPTIONAL, 'ID Année') ->addOption('intervenant', 'i', InputOption::VALUE_OPTIONAL, 'ID Intervenant'); } protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); $io->title($this->getDescription()); $tableauBord = $input->getArgument('tableau-bord'); $anneeId = $input->getOption('annee'); $intervenantId = $input->getOption('intervenant'); $this->progressBar = $io->createProgressBar(0); $this->getServiceTableauBord()->setOnAction(function (Event $event) use ($io) { $this->onEvent($event, $io); }); if ($tableauBord) { $params = []; if ($anneeId) { $params['ANNEE_ID'] = (int)$anneeId; } if ($intervenantId){ $params['INTERVENANT_ID'] = (int)$intervenantId; } $this->getServiceTableauBord()->calculer($tableauBord, $params); return Command::SUCCESS; }else{ $result = $this->getServiceTableauBord()->calculerTout(['formule']); $io->comment('Fin du calcul des tableaux de bord'); Loading @@ -49,6 +74,7 @@ class CalculTableauxBordCommand extends Command return Command::FAILURE; } } } Loading