mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Moved export listing functionality from ExportController to a new ExportIndexController
for improved separation of concerns. Updated tests accordingly to reflect the new controller structure.
This commit is contained in:
parent
1375a41de2
commit
80d8f967fa
@ -178,21 +178,6 @@ class ExportController extends AbstractController
|
||||
return new Response('Ok: '.$exportGeneration->getId()->toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the list of available exports.
|
||||
*/
|
||||
#[Route(path: '/{_locale}/exports/', name: 'chill_main_export_index')]
|
||||
public function indexAction(): Response
|
||||
{
|
||||
$exportManager = $this->exportManager;
|
||||
|
||||
$exports = $exportManager->getExportsGrouped(true);
|
||||
|
||||
return $this->render('@ChillMain/Export/layout.html.twig', [
|
||||
'grouped_exports' => $exports,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* handle the step to build a query for an export.
|
||||
*
|
||||
|
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\Export\ExportManager;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Twig\Environment;
|
||||
|
||||
final readonly class ExportIndexController
|
||||
{
|
||||
public function __construct(private ExportManager $exportManager, private Environment $twig) {}
|
||||
|
||||
/**
|
||||
* Render the list of available exports.
|
||||
*/
|
||||
#[Route(path: '/{_locale}/exports/', name: 'chill_main_export_index')]
|
||||
public function indexAction(ExportController $exportController): Response
|
||||
{
|
||||
$exports = $this->exportManager->getExportsGrouped(true);
|
||||
|
||||
return new Response(
|
||||
$this->twig->render('@ChillMain/Export/layout.html.twig', [
|
||||
'grouped_exports' => $exports,
|
||||
]),
|
||||
);
|
||||
}
|
||||
}
|
@ -21,13 +21,13 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ExportControllerTest extends WebTestCase
|
||||
final class ExportIndexControllerTest extends WebTestCase
|
||||
{
|
||||
use PrepareClientTrait;
|
||||
|
||||
public function testIndex()
|
||||
{
|
||||
$client = $this->getClientAuthenticatedAsAdmin();
|
||||
$client = $this->getClientAuthenticated();
|
||||
|
||||
$client->request('GET', '/fr/exports/');
|
||||
|
Loading…
x
Reference in New Issue
Block a user