src/Controller/En/HomeEnController.php line 33

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\En;
  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. /**
  21.  * @Route("/en",name="en-")
  22.  */
  23. class HomeEnController extends AbstractController
  24. {
  25.     /**
  26.      * @Route(name="home")
  27.      * @return \Symfony\Component\HttpFoundation\Response
  28.      */
  29.     public function index()
  30.     {
  31.         return $this->render('views/en/index.html.twig');
  32.     }
  33.     /**
  34.      * @Route("/presentation", name="presentation")
  35.      * @return \Symfony\Component\HttpFoundation\Response
  36.      */
  37.     public function presentation()
  38.     {
  39.         return $this->render('views/en/presentation.html.twig');
  40.     }
  41.     /**
  42.      * @Route("/management", name="management")
  43.      * @return \Symfony\Component\HttpFoundation\Response
  44.      */
  45.     public function management()
  46.     {
  47.         return $this->render('views/en/management.html.twig');
  48.     }
  49.     /**
  50.      * @Route("/history", name="historique")
  51.      * @return \Symfony\Component\HttpFoundation\Response
  52.      */
  53.     public function historique()
  54.     {
  55.         return $this->render('views/en/history.html.twig');
  56.     }
  57.     /**
  58.      * @Route("/role-of-broker", name="role")
  59.      * @return \Symfony\Component\HttpFoundation\Response
  60.      */
  61.     public function role()
  62.     {
  63.         return $this->render('views/en/role.html.twig');
  64.     }
  65.     /**
  66.      * @Route("/physical-market", name="physique")
  67.      * @return \Symfony\Component\HttpFoundation\Response
  68.      */
  69.     public function physique()
  70.     {
  71.         return $this->render('views/en/physique.html.twig');
  72.     }
  73.     /**
  74.      * @Route("/futures-market", name="terme")
  75.      * @return \Symfony\Component\HttpFoundation\Response
  76.      */
  77.     public function terme()
  78.     {
  79.         return $this->render('views/en/terme.html.twig');
  80.     }
  81.     /**
  82.      * @Route("/financial-structure", name="structure")
  83.      * @return \Symfony\Component\HttpFoundation\Response
  84.      */
  85.     public function structure()
  86.     {
  87.         return $this->render('views/en/structurer.html.twig');
  88.     }
  89.     /**
  90.      * @Route("/prod-in-management", name="prod_en_gestion")
  91.      * @return \Symfony\Component\HttpFoundation\Response
  92.      */
  93.     public function proEnGestion()
  94.     {
  95.         return $this->render('views/en/prod-en-gestion.html.twig');
  96.     }
  97.     /**
  98.      * @Route("/underlying-assets", name="actifs_sous_jacents")
  99.      * @return \Symfony\Component\HttpFoundation\Response
  100.      */
  101.     public function actifSouJecents()
  102.     {
  103.         return $this->render('views/en/actifs-sous-jacents.html.twig');
  104.     }
  105.     /**
  106.      * @Route("/contact-us", name="contact")
  107.      * @return \Symfony\Component\HttpFoundation\Response
  108.      */
  109.     public function contact()
  110.     {
  111.         return $this->render('views/en/contact.html.twig');
  112.     }
  113.     /**
  114.      * @Route("/history", name="history")
  115.      * @return \Symfony\Component\HttpFoundation\Response
  116.      */
  117.     public function history()
  118.     {
  119.         return $this->render('views/en/historique.html.twig');
  120.     }
  121.     /**
  122.      * @Route("/mission/guarantee-the-transactions", name="garantir")
  123.      * @return \Symfony\Component\HttpFoundation\Response
  124.      */
  125.     public function garantie()
  126.     {
  127.         return $this->render('views/missions/en/garantie.html.twig');
  128.     }
  129.     /**
  130.      * @Route("/mission/optimize-your-business", name="optimiser")
  131.      * @return \Symfony\Component\HttpFoundation\Response
  132.      */
  133.     public function optimise()
  134.     {
  135.         return $this->render('views/missions/en/optimise.html.twig');
  136.     }
  137.     /**
  138.      * @Route("/mission/deliverer-of-advice-and-information", name="deliver")
  139.      * @return \Symfony\Component\HttpFoundation\Response
  140.      */
  141.     public function delivrer()
  142.     {
  143.         return $this->render('views/missions/en/delivrer.html.twig');
  144.     }
  145.     /**
  146.      * @Route("/mission/facilitate-access-to-international-markets", name="faciliter")
  147.      * @return \Symfony\Component\HttpFoundation\Response
  148.      */
  149.     public function faciliter()
  150.     {
  151.         return $this->render('views/missions/en/faciliter.html.twig');
  152.     }
  153.     /**
  154.      * @Route("/mission/capital-management", name="gestion-capitaux")
  155.      * @return \Symfony\Component\HttpFoundation\Response
  156.      */
  157.     public function gestion()
  158.     {
  159.         return $this->render('views/missions/en/gestion.html.twig');
  160.     }
  161.     /**
  162.      * @Route("/mission/hedge-and-arbitrage", name="couverture-arbitrage")
  163.      * @return \Symfony\Component\HttpFoundation\Response
  164.      */
  165.     public function arbitrage()
  166.     {
  167.         return $this->render('views/missions/en/arbitrage.html.twig');
  168.     }
  169.     /**
  170.  * @Route("/mission/advice-and-information", name="conseils-et-informations")
  171.  * @return \Symfony\Component\HttpFoundation\Response
  172.  */
  173.     public function strategie()
  174.     {
  175.         return $this->render('views/missions/en/strategies.html.twig');
  176.     }
  177.     /**
  178.      * @Route("/mission/intermediate-negotiation-and-services", name="negociation")
  179.      * @return \Symfony\Component\HttpFoundation\Response
  180.      */
  181.     public function negociation()
  182.     {
  183.         return $this->render('views/missions/en/negociations.html.twig');
  184.     }
  185.     /**
  186.      * @Route("/mission/connecting", name="relation")
  187.      * @return \Symfony\Component\HttpFoundation\Response
  188.      */
  189.     public function miseEnrelation()
  190.     {
  191.         return $this->render('views/missions/en/relation.html.twig');
  192.     }
  193.     /**
  194.      * @Route("/essai/{id}", name="matiere_by_product")
  195.      * @param Products $id
  196.      * @param SerializerInterface $serializer
  197.      * @param ProductsRepository $productsRepository
  198.      * @return Response
  199.      */
  200.     public function getMatiereByProduct(Products $idSerializerInterface $serializerProductsRepository $productsRepositoryMatPremiereRepository $matPremiereRepository){
  201.         $matieres $productsRepository->find($id);
  202.        // dd($matieres);
  203.         $encoder = new JsonEncoder();
  204.         $defaultContext = [
  205.             AbstractNormalizer::CIRCULAR_REFERENCE_HANDLER => function ($object$format$context) {
  206.                 return $object->getName();
  207.             },
  208.         ];
  209.         $normalizer = new ObjectNormalizer(nullnullnullnullnullnull$defaultContext);
  210.         $serializer = new Serializer([$normalizer], [$encoder]);
  211.         $data $serializer->serialize($matieres'json');
  212.         return new Response($data200, [
  213.             'Content-Type' => 'application/json'
  214.         ]);
  215.     }
  216. }