src/Controller/DefaultController.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Apprenant;
  4. use App\Entity\Client;
  5. use App\Entity\Compagne;
  6. use App\Entity\Projet;
  7. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  8. use Symfony\Component\Routing\Annotation\Route;
  9. class DefaultController extends AbstractController
  10. {
  11. /**
  12. * @Route("/accueil", name="home")
  13. */
  14. public function home()
  15. {
  16. if (!$this->getUser()) {
  17. return $this->redirectToRoute('app_login');
  18. }
  19. $doctrine = $this->getDoctrine();
  20. return $this->render('default/home.html.twig', [
  21. "nbClients" => $doctrine->getRepository(Client::class)->count([]),
  22. "nbProjets" => $doctrine->getRepository(Projet::class)->count([]),
  23. "nbApprenants" => $doctrine->getRepository(Apprenant::class)->count([]),
  24. "apprscompagnes" => $doctrine->getRepository(Compagne::class)->getTotalApprs(),
  25. ]);
  26. }
  27. }