<?php
// src/Controller/EntrepriseController.php
namespace App\Controller;
use App\Entity\SujetFAQ;
use App\Entity\Article;
use App\Entity\AppUser;
use App\Entity\Product;
use App\Entity\Review;
use App\Entity\Category;
use App\Entity\Order;
use App\Entity\SlidePromo;
use App\Entity\ProductOrder;
use App\Entity\Entreprise;
use App\Entity\ProductMisDeCote;
use App\Entity\SubCategory;
use App\Entity\AvisUtilisateur;
use App\Form\SujetFAQType;
use App\Form\AvisUtilisateurType;
use App\Form\AvisUtilisateurEditType;
use App\Form\ProductType;
use App\Entity\ShippingMethod;
use App\Entity\AbonneNewsletter;
use App\Entity\Coupon;
use App\Entity\UserBoutique;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
/**
* @Route("")
*/
class IndexController extends AbstractController
{
/**
* @Route("", name="home_first")
* @return \Symfony\Component\HttpFoundation\Response
*
*/
public function indexFirstAction()
{
$ic = $this->indexContentAction();
return $this->render('entreprise/index.html.twig', [
'userBoutiques' => $ic['userBoutiques']
]);
}
/**
* @Route("/{_locale}", name="home")
* @return \Symfony\Component\HttpFoundation\Response
*/
public function indexAction($_locale = 'fr')
{
$ic = $this->indexContentAction();
return $this->render('entreprise/index.html.twig', [
'userBoutiques' => $ic['userBoutiques']
]);
}
/**
* @Route("/{_locale}/chose-language", name="change_language")
* @return \Symfony\Component\HttpFoundation\Response
*/
public function changeLanguageAction()
{
$languages = array('en', 'fr');
return $this->render('entreprise/change_language.html.twig', [
'languages' => $languages
]);
}
public function indexContentAction()
{
$em = $this->getDoctrine()
->getManager();
$user = $this->getUser();
$userBoutiques = $em->getRepository(UserBoutique::class)
->findByUser($user);
return
array(
'user' => $user,
'userBoutiques' => $userBoutiques
);
}
}