src/Controller/IndexController.php line 46

Open in your IDE?
  1. <?php
  2. // src/Controller/EntrepriseController.php
  3. namespace App\Controller;
  4. use App\Entity\SujetFAQ;
  5. use App\Entity\Article;
  6. use App\Entity\AppUser;
  7. use App\Entity\Product;
  8. use App\Entity\Review;
  9. use App\Entity\Category;
  10. use App\Entity\Order;
  11. use App\Entity\SlidePromo;
  12. use App\Entity\ProductOrder;
  13. use App\Entity\Entreprise;
  14. use App\Entity\ProductMisDeCote;
  15. use App\Entity\SubCategory;
  16. use App\Entity\AvisUtilisateur;
  17. use App\Form\SujetFAQType;
  18. use App\Form\AvisUtilisateurType;
  19. use App\Form\AvisUtilisateurEditType;
  20. use App\Form\ProductType;
  21. use App\Entity\ShippingMethod;
  22. use App\Entity\AbonneNewsletter;
  23. use App\Entity\Coupon;
  24. use App\Entity\UserBoutique;
  25. use Symfony\Component\HttpFoundation\Response;
  26. use Symfony\Component\HttpFoundation\Session\SessionInterface;
  27. use Symfony\Component\HttpFoundation\Request;
  28. use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
  29. use Symfony\Component\Routing\Annotation\Route;
  30. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  31. /**
  32.  * @Route("")
  33.  */
  34. class IndexController extends AbstractController
  35. {    
  36.     
  37.     /**
  38.      * @Route("", name="home_first")
  39.      * @return \Symfony\Component\HttpFoundation\Response
  40.      *
  41.      */
  42.     public function indexFirstAction()
  43.     {
  44.         
  45.         $ic $this->indexContentAction();
  46.         
  47.         return $this->render('entreprise/index.html.twig', [
  48.            'userBoutiques' => $ic['userBoutiques']
  49.         ]);
  50.     }
  51.     
  52.     
  53.     /**
  54.      * @Route("/{_locale}", name="home")
  55.      * @return \Symfony\Component\HttpFoundation\Response
  56.      */
  57.     public function indexAction($_locale 'fr')
  58.     {
  59.         $ic $this->indexContentAction();
  60.         
  61.         return $this->render('entreprise/index.html.twig', [
  62.            'userBoutiques' => $ic['userBoutiques']
  63.         ]);
  64.     }
  65.     
  66.     /**
  67.      * @Route("/{_locale}/chose-language", name="change_language")
  68.      * @return \Symfony\Component\HttpFoundation\Response
  69.      */
  70.     public function changeLanguageAction()
  71.     {
  72.         $languages = array('en''fr');
  73.         return $this->render('entreprise/change_language.html.twig', [
  74.             'languages' => $languages
  75.         ]);
  76.     }
  77.     public function indexContentAction()
  78.     {
  79.         $em $this->getDoctrine()
  80.                     ->getManager();
  81.         $user $this->getUser();
  82.         $userBoutiques $em->getRepository(UserBoutique::class)
  83.                             ->findByUser($user);
  84.         return 
  85.         array(
  86.             'user' => $user,
  87.             'userBoutiques' => $userBoutiques
  88.         );
  89.     }
  90. }