Loading code/test9.php +32 −1 Changes for code/test9.php: 32 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -3,14 +3,45 @@ /** * @var $this \Application\View\Renderer\PhpRenderer * @var $container \Psr\Container\ContainerInterface * @var $io \Symfony\Component\Console\Style\SymfonyStyle */ use Symfony\Component\Console\Style\SymfonyStyle; use UnicaenTbl\Event; $tbl = $container->get(\UnicaenTbl\Service\TableauBordService::class); $params = [ //'INTERVENANT_ID' => 940962, //'INTERVENANT_ID' => 665114, 'ANNEE_ID' => 2021, //'ANNEE_ID' => 2021, ]; $progresBar = $io->createProgressBar(0); $tbl->setOnAction(function (Event $event) use ($io, $progresBar) { switch ($event->action) { case Event::CALCUL: break; case Event::FINISH: $io->info("Calcul effectué en " . round($event->tableauBord->getTiming(), 3) . " secondes"); break; case Event::GET: $io->info("Récupération des données"); break; case Event::PROCESS: $io->info("Traitement"); $progresBar = $io->createProgressBar($event->total); break; case Event::SET: $io->info("Enregistrement"); $progresBar = $io->createProgressBar($event->total); break; case Event::PROGRESS: $progresBar->setMaxSteps($event->total); $progresBar->setProgress($event->progress); } } ); $tbl->calculer('contrat', $params); module/Contrat/src/Tbl/Process/ContratProcess.php +11 Changes for module/Contrat/src/Tbl/Process/ContratProcess.php: 11 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ use Paiement\Service\TauxRemuServiceAwareTrait; use Service\Entity\Db\TypeService; use Service\Service\TypeServiceServiceAwareTrait; use Unicaen\BddAdmin\BddAwareTrait; use UnicaenTbl\Event; use UnicaenTbl\Process\ProcessInterface; use UnicaenTbl\Service\BddServiceAwareTrait; use UnicaenTbl\TableauBord; Loading Loading @@ -70,12 +71,19 @@ class ContratProcess implements ProcessInterface } } else { $this->init(); $tableauBord->onAction(Event::GET); $this->loadContrats($params); $this->loadVolumesHoraires($params); $count = count($this->intervenants); $index = 0; $tableauBord->onAction(Event::PROCESS, 0, $count); foreach ($this->intervenants as $contrats) { $index++; $tableauBord->onAction(Event::PROGRESS, $index, $count); $this->traitement($contrats); } $this->exporter(); $tableauBord->onAction(Event::SET, 0, $count); $this->enregistrement($tableauBord, $params); } } Loading Loading @@ -845,6 +853,9 @@ if (!$contrat->annee){ 'where' => $params, 'return-insert-data' => false, 'transaction' => !isset($params['INTERVENANT_ID']), 'callback' => function (string $action, int $progress, int $total, array $data = [], array $key = []) use ($tableauBord) { $tableauBord->onAction(Event::PROGRESS, $progress, $total); }, ]; $table->merge($this->tblData, $key, $options); Loading Loading
code/test9.php +32 −1 Changes for code/test9.php: 32 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -3,14 +3,45 @@ /** * @var $this \Application\View\Renderer\PhpRenderer * @var $container \Psr\Container\ContainerInterface * @var $io \Symfony\Component\Console\Style\SymfonyStyle */ use Symfony\Component\Console\Style\SymfonyStyle; use UnicaenTbl\Event; $tbl = $container->get(\UnicaenTbl\Service\TableauBordService::class); $params = [ //'INTERVENANT_ID' => 940962, //'INTERVENANT_ID' => 665114, 'ANNEE_ID' => 2021, //'ANNEE_ID' => 2021, ]; $progresBar = $io->createProgressBar(0); $tbl->setOnAction(function (Event $event) use ($io, $progresBar) { switch ($event->action) { case Event::CALCUL: break; case Event::FINISH: $io->info("Calcul effectué en " . round($event->tableauBord->getTiming(), 3) . " secondes"); break; case Event::GET: $io->info("Récupération des données"); break; case Event::PROCESS: $io->info("Traitement"); $progresBar = $io->createProgressBar($event->total); break; case Event::SET: $io->info("Enregistrement"); $progresBar = $io->createProgressBar($event->total); break; case Event::PROGRESS: $progresBar->setMaxSteps($event->total); $progresBar->setProgress($event->progress); } } ); $tbl->calculer('contrat', $params);
module/Contrat/src/Tbl/Process/ContratProcess.php +11 Changes for module/Contrat/src/Tbl/Process/ContratProcess.php: 11 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ use Paiement\Service\TauxRemuServiceAwareTrait; use Service\Entity\Db\TypeService; use Service\Service\TypeServiceServiceAwareTrait; use Unicaen\BddAdmin\BddAwareTrait; use UnicaenTbl\Event; use UnicaenTbl\Process\ProcessInterface; use UnicaenTbl\Service\BddServiceAwareTrait; use UnicaenTbl\TableauBord; Loading Loading @@ -70,12 +71,19 @@ class ContratProcess implements ProcessInterface } } else { $this->init(); $tableauBord->onAction(Event::GET); $this->loadContrats($params); $this->loadVolumesHoraires($params); $count = count($this->intervenants); $index = 0; $tableauBord->onAction(Event::PROCESS, 0, $count); foreach ($this->intervenants as $contrats) { $index++; $tableauBord->onAction(Event::PROGRESS, $index, $count); $this->traitement($contrats); } $this->exporter(); $tableauBord->onAction(Event::SET, 0, $count); $this->enregistrement($tableauBord, $params); } } Loading Loading @@ -845,6 +853,9 @@ if (!$contrat->annee){ 'where' => $params, 'return-insert-data' => false, 'transaction' => !isset($params['INTERVENANT_ID']), 'callback' => function (string $action, int $progress, int $total, array $data = [], array $key = []) use ($tableauBord) { $tableauBord->onAction(Event::PROGRESS, $progress, $total); }, ]; $table->merge($this->tblData, $key, $options); Loading