src/Controller/HomeController.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Candidature;
  4. use App\Entity\Offer;
  5. use App\Entity\Structure;
  6. use App\Entity\User;
  7. use Doctrine\Persistence\ManagerRegistry;
  8. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  9. use Symfony\Component\HttpFoundation\Response;
  10. use Symfony\Component\Routing\Annotation\Route;
  11. class HomeController extends AbstractController
  12. {
  13.     /**
  14.      * @Route("/", name="app_home")
  15.      */
  16.     public function home(ManagerRegistry $doctrine): Response
  17.     {
  18.         $entityManager $doctrine->getManager();
  19.         $offer $entityManager->getRepository(Offer::class)->findAll();
  20.         $candidature $entityManager->getRepository(Candidature::class)->findAll();
  21.         $structure $entityManager->getRepository(Structure::class)->findAll();
  22.         $nboffer count($offer);
  23.         $nbcandidature count($candidature);
  24. //        $nbuser = 0;
  25.         $nbStruct count($structure);
  26. //        for ($i = 0; $i <= count($user) - 1; $i++) {
  27. //            $role = $user[$i]->getRoles();
  28. //
  29. //            if ($role[0] == "ROLE_ADMIN_STRUCTURE") {
  30. //                $nbuser++;
  31. //            }
  32. //        }
  33.         return $this->render('home/index.html.twig', ['offer' => $nboffer'candidature' => $nbcandidature'structure' => $nbStruct]);
  34.     }
  35.     /**
  36.      * @Route("/listcandidature/{id}", name="app_apply")
  37.      */
  38.     public function apply(int $idManagerRegistry $doctrine): Response
  39.     {
  40.         $entityManager $doctrine->getManager();
  41.         $candidature $entityManager->getRepository(Candidature::class)->findAll();
  42.         $offer $entityManager->getRepository(Offer::class)->find($id);
  43.         return $this->render('home/listcandidature.html.twig', ['candidature' => $candidature'offer' => $offer]);
  44.     }
  45.     /**
  46.      * @Route("/connect", name="app_connect")
  47.      */
  48.     public function connect(): Response
  49.     {
  50.         return $this->render('home/connect.html.twig');
  51.     }
  52.     /**
  53.      * @Route("/passforget", name="app_passforget")
  54.      */
  55.     public function passforget(): Response
  56.     {
  57.         return $this->render('home/passforget.html.twig');
  58.     }
  59.     /**
  60.      * @Route("/allcandidature", name="app_allcandidature")
  61.      */
  62.     public function allcandidature(ManagerRegistry $doctrine): Response
  63.     {
  64.         $entityManager $doctrine->getManager();
  65.         $candidature $entityManager->getRepository(Candidature::class)->findAll();
  66.         return $this->render('home/allcandidatures.html.twig', ['candidature' => $candidature]);
  67.     }
  68.     /**
  69.      * @Route("/alluser", name="app_alluser")
  70.      */
  71.     public function alluser(ManagerRegistry $doctrine): Response
  72.     {
  73.         $entityManager $doctrine->getManager();
  74.         $user $entityManager->getRepository(User::class)->findAll();
  75.         return $this->render('home/alluser.html.twig', ['user' => $user]);
  76.     }
  77. }