src/Controller/IndexController.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Post;
  4. use App\Entity\Accueil;
  5. use App\Entity\Blog;
  6. use App\Entity\Prices;
  7. use App\Entity\AncienEvenement;
  8. use App\Entity\EvenementAVenir;
  9. use App\Entity\Congre;
  10. use App\Entity\Document;
  11. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  12. use Symfony\Component\Routing\Annotation\Route;
  13. use Symfony\Component\HttpFoundation\Response;
  14. use Doctrine\Persistence\ManagerRegistry;
  15. class IndexController extends AbstractController
  16. {
  17.     
  18.     public function index(ManagerRegistry $doctrine): Response
  19.     {
  20.         $product $doctrine->getRepository(Accueil::class)->find(5);
  21.         $ancien $doctrine->getRepository(AncienEvenement::class)->findAll();
  22.         $dernier_congre=$doctrine->getRepository(Congre::class)->findBy(array('desplay'=>1), array('id' => 'desc'),1,0);
  23.         $dernier_evenement=$doctrine->getRepository(EvenementAvenir::class)->findBy(array('desplay'=>1), array('id' => 'desc'),1,0);
  24.         $blog $doctrine->getRepository(Blog::class)->findBy(array(), array('id' => 'desc'),6,0);
  25.         return $this->render('index/index.html.twig',['product'=>$product,'ancien'=>$ancien,'dernier_congre'=>$dernier_congre,'blog'=>$blog,'dernier_evenement'=>$dernier_evenement]);
  26.     }
  27.     public function apropos(ManagerRegistry $doctrine): Response
  28.     {
  29.      
  30.         return $this->render('apropos/apropos.html.twig');
  31.     }
  32.     public function getDocumentByUser(ManagerRegistry $doctrine): Response
  33.     {
  34.         $id_user=1;
  35.         $nb=0;
  36.         $event $doctrine->getRepository(EvenementAVenir::class)->findAll();
  37.         $document $doctrine->getRepository(Document::class)->findAll();
  38.         $congre $doctrine->getRepository(Congre::class)->findBy(array('userId' =>$id_user));
  39.         foreach($document as $a)
  40.         {
  41.             $congre $doctrine->getRepository(Congre::class)->findBy(array('userId' =>$id_user,'titre' =>$a->getEvenementSelect()));
  42.             if($congre !=Null)
  43.             {
  44.                 $nb++;
  45.             }
  46.         }
  47.         
  48.         
  49.         return new Response($nb);
  50.         
  51.     }
  52. }