Loading module/Application/src/Service/AnneeService.php +4 −1 Original line number Diff line number Diff line Loading @@ -87,9 +87,12 @@ class AnneeService extends AbstractEntityService /** * @return array|Annee[] */ public function getActives(): array public function getActives(bool $desc = false): array { $dql = "SELECT a FROM ".Annee::class." a WHERE a.active = 1 ORDER BY a.id"; if ($desc){ $dql .= " DESC"; } $query = $this->getEntityManager()->createQuery($dql); Loading module/Formule/src/Command/CalculCommand.php +11 −5 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ namespace Formule\Command; use Application\Service\Traits\AnneeServiceAwareTrait; 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\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; Loading @@ -25,7 +26,8 @@ class CalculCommand extends Command protected function configure(): void { $this->setDescription('Recalcul de toutes les formules'); $this->setDescription('Recalcul de toutes les formules') ->addArgument('anneeId', InputArgument::OPTIONAL, 'Id de l\'année pour laquelle seront lancées les formules');; } Loading @@ -35,18 +37,22 @@ class CalculCommand extends Command $io = new SymfonyStyle($input, $output); $io->title($this->getDescription()); $anneeId = $input->getArgument('anneeId'); $io->warning("Ce traitement peut prendre plusieurs minutes"); $this->getServiceTableauBord()->setOnAction(function(Event $event) use ($io){ $this->onEvent($event, $io); }); $annees = $this->getServiceAnnee()->getActives(); $annees = $this->getServiceAnnee()->getActives(true); foreach ($annees as $annee) { if ($annee->getId() == $anneeId || $anneeId === null) { $io->comment('Calcul pour l\'année '.$annee->getLibelle()); $params = ['ANNEE_ID' => $annee->getId()]; $this->getServiceTableauBord()->calculer('formule', $params); } } return Command::SUCCESS; } Loading Loading
module/Application/src/Service/AnneeService.php +4 −1 Original line number Diff line number Diff line Loading @@ -87,9 +87,12 @@ class AnneeService extends AbstractEntityService /** * @return array|Annee[] */ public function getActives(): array public function getActives(bool $desc = false): array { $dql = "SELECT a FROM ".Annee::class." a WHERE a.active = 1 ORDER BY a.id"; if ($desc){ $dql .= " DESC"; } $query = $this->getEntityManager()->createQuery($dql); Loading
module/Formule/src/Command/CalculCommand.php +11 −5 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ namespace Formule\Command; use Application\Service\Traits\AnneeServiceAwareTrait; 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\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; Loading @@ -25,7 +26,8 @@ class CalculCommand extends Command protected function configure(): void { $this->setDescription('Recalcul de toutes les formules'); $this->setDescription('Recalcul de toutes les formules') ->addArgument('anneeId', InputArgument::OPTIONAL, 'Id de l\'année pour laquelle seront lancées les formules');; } Loading @@ -35,18 +37,22 @@ class CalculCommand extends Command $io = new SymfonyStyle($input, $output); $io->title($this->getDescription()); $anneeId = $input->getArgument('anneeId'); $io->warning("Ce traitement peut prendre plusieurs minutes"); $this->getServiceTableauBord()->setOnAction(function(Event $event) use ($io){ $this->onEvent($event, $io); }); $annees = $this->getServiceAnnee()->getActives(); $annees = $this->getServiceAnnee()->getActives(true); foreach ($annees as $annee) { if ($annee->getId() == $anneeId || $anneeId === null) { $io->comment('Calcul pour l\'année '.$annee->getLibelle()); $params = ['ANNEE_ID' => $annee->getId()]; $this->getServiceTableauBord()->calculer('formule', $params); } } return Command::SUCCESS; } Loading