Skip to content
Snippets Groups Projects
Commit 02d0d176 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Correction de la route console pour rafraichir les indicateurs

parent 381c80e5
Branches
Tags
No related merge requests found
Pipeline #27433 passed
<?php
use UnicaenIndicateur\Controller\IndicateurConsoleController;
use UnicaenIndicateur\Controller\IndicateurConsoleControllerFactory;
use UnicaenIndicateur\Controller\IndicateurController;
use UnicaenIndicateur\Controller\IndicateurControllerFactory;
use UnicaenIndicateur\Form\Indicateur\IndicateurForm;
......@@ -53,7 +55,7 @@ return [
],
],
[
'controller' => IndicateurController::class,
'controller' => IndicateurConsoleController::class,
'action' => [
'rafraichir-console',
],
......@@ -174,7 +176,7 @@ return [
'options' => [
'route' => 'indicateur-refresh',
'defaults' => [
'controller' => IndicateurController::class,
'controller' => IndicateurConsoleController::class,
'action' => 'rafraichir-console'
],
],
......@@ -191,6 +193,7 @@ return [
'controllers' => [
'factories' => [
IndicateurController::class => IndicateurControllerFactory::class,
IndicateurConsoleController::class => IndicateurConsoleControllerFactory::class,
],
],
'form_elements' => [
......
......@@ -20,4 +20,9 @@ class CategorieController extends AbstractActionController
'categories' => $categories,
]);
}
public function ajouterAction(): ViewModel
{
}
}
\ No newline at end of file
<?php
namespace UnicaenIndicateur\Controller;
use Unicaen\Console\Controller\AbstractConsoleController;
use UnicaenIndicateur\Service\Indicateur\IndicateurServiceAwareTrait;
class IndicateurConsoleController extends AbstractConsoleController
{
use IndicateurServiceAwareTrait;
public function rafraichirConsoleAction(): void
{
$indicateurs = $this->getIndicateurService()->getIndicateurs();
foreach ($indicateurs as $indicateur) {
$this->getIndicateurService()->refresh($indicateur);
}
}
}
\ No newline at end of file
<?php
namespace UnicaenIndicateur\Controller;
use Psr\Container\ContainerInterface;
use Unicaen\Console\Controller\AbstractConsoleController;
use UnicaenIndicateur\Service\Indicateur\IndicateurService;
use UnicaenIndicateur\Service\Indicateur\IndicateurServiceAwareTrait;
class IndicateurConsoleControllerFactory
{
public function __invoke(ContainerInterface $container): IndicateurConsoleController
{
/**
* @var IndicateurService $indicateurService
*/
$indicateurService = $container->get(IndicateurService::class);
$controller = new IndicateurConsoleController();
$controller->setIndicateurService($indicateurService);
return $controller;
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment