src/Controller/Fr/HomeFrController.php line 40

Open in your IDE?
  1. <?php
  2. /**
  3.  * Created by PhpStorm.
  4.  * User: PKDTECHNOLOGIESINC-K
  5.  * Date: 17/08/2019
  6.  * Time: 12:33
  7.  */
  8. namespace App\Controller\Fr;
  9. use App\Entity\Products;
  10. use App\Repository\MatPremiereRepository;
  11. use App\Repository\ProductsRepository;
  12. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  13. use Symfony\Component\HttpFoundation\Response;
  14. use Symfony\Component\Routing\Annotation\Route;
  15. use Symfony\Component\Serializer\Encoder\JsonEncoder;
  16. use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
  17. use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
  18. use Symfony\Component\Serializer\Serializer;
  19. use Symfony\Component\Serializer\SerializerInterface;
  20. class HomeFrController extends AbstractController
  21. {
  22.     /**
  23.      * @Route("/", name="home")
  24.      * @return \Symfony\Component\HttpFoundation\Response
  25.      */
  26.     public function index()
  27.     {
  28.         return $this->render('views/index.html.twig');
  29.     }
  30.     /**
  31.      * @Route("/presentation", name="presentation")
  32.      * @return \Symfony\Component\HttpFoundation\Response
  33.      */
  34.     public function presentation()
  35.     {
  36.         return $this->render('views/presentation.html.twig');
  37.     }
  38.     /**
  39.      * @Route("/management", name="management")
  40.      * @return \Symfony\Component\HttpFoundation\Response
  41.      */
  42.     public function management()
  43.     {
  44.         return $this->render('views/management.html.twig');
  45.     }
  46.     /**
  47.      * @Route("/historique", name="historique")
  48.      * @return \Symfony\Component\HttpFoundation\Response
  49.      */
  50.     public function historique()
  51.     {
  52.         return $this->render('views/history.html.twig');
  53.     }
  54.     /**
  55.      * @Route("/role-du-courtier", name="role")
  56.      * @return \Symfony\Component\HttpFoundation\Response
  57.      */
  58.     public function role()
  59.     {
  60.         return $this->render('views/role.html.twig');
  61.     }
  62.     /**
  63.      * @Route("/marche-physique", name="physique")
  64.      * @return \Symfony\Component\HttpFoundation\Response
  65.      */
  66.     public function physique()
  67.     {
  68.         return $this->render('views/physique.html.twig');
  69.     }
  70.     /**
  71.      * @Route("/marche-a-terme", name="terme")
  72.      * @return \Symfony\Component\HttpFoundation\Response
  73.      */
  74.     public function terme()
  75.     {
  76.         return $this->render('views/terme.html.twig');
  77.     }
  78.     /**
  79.      * @Route("/structure-finance", name="structure")
  80.      * @return \Symfony\Component\HttpFoundation\Response
  81.      */
  82.     public function structure()
  83.     {
  84.         return $this->render('views/structurer.html.twig');
  85.     }
  86.     /**
  87.      * @Route("/prod-en-gestion", name="prod_en_gestion")
  88.      * @return \Symfony\Component\HttpFoundation\Response
  89.      */
  90.     public function proEnGestion()
  91.     {
  92.         return $this->render('views/prod-en-gestion.html.twig');
  93.     }
  94.     /**
  95.      * @Route("/actifs-sous-jacents", name="actifs_sous_jacents")
  96.      * @return \Symfony\Component\HttpFoundation\Response
  97.      */
  98.     public function actifSouJecents()
  99.     {
  100.         return $this->render('views/actifs-sous-jacents.html.twig');
  101.     }
  102.     /**
  103.      * @Route("/contact-us", name="contact")
  104.      * @return \Symfony\Component\HttpFoundation\Response
  105.      */
  106.     public function contact()
  107.     {
  108.         return $this->render('views/contact.html.twig');
  109.     }
  110.     /**
  111.      * @Route("/history", name="history")
  112.      * @return \Symfony\Component\HttpFoundation\Response
  113.      */
  114.     public function history()
  115.     {
  116.         return $this->render('views/historique.html.twig');
  117.     }
  118.     /**
  119.      * @Route("/mission/garantir-les-transactions", name="garantir")
  120.      * @return \Symfony\Component\HttpFoundation\Response
  121.      */
  122.     public function garantie()
  123.     {
  124.         return $this->render('views/missions/garantie.html.twig');
  125.     }
  126.     /**
  127.      * @Route("/mission/optimiser-vos-affaires", name="optimiser")
  128.      * @return \Symfony\Component\HttpFoundation\Response
  129.      */
  130.     public function optimise()
  131.     {
  132.         return $this->render('views/missions/optimise.html.twig');
  133.     }
  134.     /**
  135.      * @Route("/mission/delivrer-du-conseil-et-de-l-information", name="deliver")
  136.      * @return \Symfony\Component\HttpFoundation\Response
  137.      */
  138.     public function delivrer()
  139.     {
  140.         return $this->render('views/missions/delivrer.html.twig');
  141.     }
  142.     /**
  143.      * @Route("/mission/faciliter-l-acces-aux-marches-internatinaux", name="faciliter")
  144.      * @return \Symfony\Component\HttpFoundation\Response
  145.      */
  146.     public function faciliter()
  147.     {
  148.         return $this->render('views/missions/faciliter.html.twig');
  149.     }
  150.     /**
  151.      * @Route("/mission/gestion-des-capitaux", name="gestion-capitaux")
  152.      * @return \Symfony\Component\HttpFoundation\Response
  153.      */
  154.     public function gestion()
  155.     {
  156.         return $this->render('views/missions/gestion.html.twig');
  157.     }
  158.     /**
  159.      * @Route("/mission/couverture-et-arbitrage", name="couverture-arbitrage")
  160.      * @return \Symfony\Component\HttpFoundation\Response
  161.      */
  162.     public function arbitrage()
  163.     {
  164.         return $this->render('views/missions/arbitrage.html.twig');
  165.     }
  166.     /**
  167.  * @Route("/mission/conseils-et-informations", name="conseils-et-informations")
  168.  * @return \Symfony\Component\HttpFoundation\Response
  169.  */
  170.     public function strategie()
  171.     {
  172.         return $this->render('views/missions/strategies.html.twig');
  173.     }
  174.     /**
  175.      * @Route("/mission/negociation-et-services-intermediaires", name="negociation")
  176.      * @return \Symfony\Component\HttpFoundation\Response
  177.      */
  178.     public function negociation()
  179.     {
  180.         return $this->render('views/missions/negociations.html.twig');
  181.     }
  182.     /**
  183.      * @Route("/mission/mise-en-relation", name="relation")
  184.      * @return \Symfony\Component\HttpFoundation\Response
  185.      */
  186.     public function miseEnrelation()
  187.     {
  188.         return $this->render('views/missions/relation.html.twig');
  189.     }
  190.     /**
  191.      * @Route("/essai/{id}", name="matiere_by_product")
  192.      * @param Products $id
  193.      * @param SerializerInterface $serializer
  194.      * @param ProductsRepository $productsRepository
  195.      * @return Response
  196.      */
  197.     public function getMatiereByProduct(Products $idSerializerInterface $serializerProductsRepository $productsRepositoryMatPremiereRepository $matPremiereRepository){
  198.         $matieres $productsRepository->find($id);
  199.        // dd($matieres);
  200.         $encoder = new JsonEncoder();
  201.         $defaultContext = [
  202.             AbstractNormalizer::CIRCULAR_REFERENCE_HANDLER => function ($object$format$context) {
  203.                 return $object->getName();
  204.             },
  205.         ];
  206.         $normalizer = new ObjectNormalizer(nullnullnullnullnullnull$defaultContext);
  207.         $serializer = new Serializer([$normalizer], [$encoder]);
  208.         $data $serializer->serialize($matieres'json');
  209.         return new Response($data200, [
  210.             'Content-Type' => 'application/json'
  211.         ]);
  212.     }
  213. }