suivi/src/Controller/DashboardAdminController.php
2022-12-19 18:35:10 +01:00

39 lines
1.4 KiB
PHP

<?php
namespace App\Controller;
use App\Core\Controller\Dashboard\DashboardAdminController as BaseController;
use App\Repository\ConferenceRepositoryQuery;
use App\Repository\DebriefingRepositoryQuery;
use App\Repository\InterventionRepositoryQuery;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
#[Route(path: '/admin')]
class DashboardAdminController extends BaseController
{
protected DebriefingRepositoryQuery $debriefingQuery;
protected ConferenceRepositoryQuery $conferenceQuery;
protected InterventionRepositoryQuery $interventionQuery;
public function __construct(
DebriefingRepositoryQuery $debriefingQuery,
ConferenceRepositoryQuery $conferenceQuery,
InterventionRepositoryQuery $interventionQuery
) {
$this->debriefingQuery = $debriefingQuery;
$this->conferenceQuery = $conferenceQuery;
$this->interventionQuery = $interventionQuery;
}
#[Route(path: '/', name: 'admin_dashboard_index')]
public function index(): Response
{
return $this->render('admin/dashboard.html.twig', [
'conferences' => $this->conferenceQuery->create()->latest()->find(),
'debriefings' => $this->debriefingQuery->create()->latest()->find(),
'interventions' => $this->interventionQuery->create()->latest()->find(),
]);
}
}