<?php
namespace App\Controller;
use App\Entity\Apprenant;
use App\Entity\Client;
use App\Entity\Compagne;
use App\Entity\Projet;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
class DefaultController extends AbstractController
{
/**
* @Route("/accueil", name="home")
*/
public function home()
{
if (!$this->getUser()) {
return $this->redirectToRoute('app_login');
}
$doctrine = $this->getDoctrine();
return $this->render('default/home.html.twig', [
"nbClients" => $doctrine->getRepository(Client::class)->count([]),
"nbProjets" => $doctrine->getRepository(Projet::class)->count([]),
"nbApprenants" => $doctrine->getRepository(Apprenant::class)->count([]),
"apprscompagnes" => $doctrine->getRepository(Compagne::class)->getTotalApprs(),
]);
}
}