src/Controller/DefaultController.php line 219

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use Doctrine\ORM\EntityManagerInterface;
  4. use Gedmo\Loggable\Entity\LogEntry;
  5. use Gedmo\Loggable\Entity\Repository\LogEntryRepository;
  6. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  7. use Symfony\Component\HttpFoundation\Response;
  8. use Symfony\Component\Routing\Annotation\Route;
  9. use Xearts\Bundle\TaobaoDaikoBundle\Entity\Feature;
  10. use Xearts\Bundle\TaobaoDaikoBundle\Entity\Information;
  11. use Xearts\Bundle\TaobaoDaikoBundle\Repository\FeatureRepository;
  12. use Xearts\Bundle\TaobaoDaikoBundle\Repository\InformationRepository;
  13. use Xearts\Bundle\TaobaoDaikoBundle\Repository\PageContentRepository;
  14. class DefaultController extends AbstractController
  15. {
  16.     /**
  17.      * @Route("/")
  18.      */
  19.     public function index(EntityManagerInterface $entityManager): Response
  20.     {
  21.         $informations $this->getInformationRepository()->findForFront(1);
  22.         /** @var Information $information */
  23.         $information null;
  24.         if ($informations) {
  25.             $information $informations[0];
  26.         }
  27.         // 特徴を取得する
  28.         $feature null;
  29.         $featureRepository $entityManager->getRepository(Feature::class);
  30.         $feature $featureRepository->findOneForFront();
  31.         return $this->render('default/index.html.twig', [
  32.             'information' => $information,
  33.             'feature' => $feature,
  34.         ]);
  35.     }
  36.     /**
  37.      * @Route("/sample/")
  38.      */
  39.     public function sample(): Response
  40.     {
  41.         //ページコンテンツを取得する
  42.         $pageContent $this->getPageContentRepository()->findOneByRouteName('app_default_sample');
  43.         return $this->render('default/sample.html.twig', [
  44.             'pageContent' => $pageContent,
  45.         ]);
  46.     }
  47.     /**
  48.      * @Route("/about/")
  49.      */
  50.     public function about(): Response
  51.     {
  52.         //ページコンテンツを取得する
  53.         $pageContent $this->getPageContentRepository()->findOneByRouteName('app_default_about');
  54.         return $this->render('default/about.html.twig', [
  55.             'pageContent' => $pageContent,
  56.         ]);
  57.     }
  58.     /**
  59.      * @Route("/fee/")
  60.      */
  61.     public function fee(): Response
  62.     {
  63.         //ページコンテンツを取得する
  64.         $pageContent $this->getPageContentRepository()->findOneByRouteName('app_default_fee');
  65.         return $this->render('default/fee.html.twig', [
  66.             'pageContent' => $pageContent,
  67.         ]);
  68.     }
  69.     /**
  70.      * @Route("/guide/")
  71.      */
  72.     public function guide(): Response
  73.     {
  74.         //ページコンテンツを取得する
  75.         $pageContent $this->getPageContentRepository()->findOneByRouteName('app_default_guide');
  76.         return $this->render('default/guide.html.twig', [
  77.             'pageContent' => $pageContent,
  78.         ]);
  79.     }
  80.     /**
  81.      * @Route("/agree/")
  82.      */
  83.     public function agree(): Response
  84.     {
  85.         //ページコンテンツを取得する
  86.         $pageContent $this->getPageContentRepository()->findOneByRouteName('app_default_agree');
  87.         return $this->render('default/agree.html.twig', [
  88.             'pageContent' => $pageContent,
  89.         ]);
  90.     }
  91.     /**
  92.      * @Route("/holiday/")
  93.      */
  94.     public function holiday(): Response
  95.     {
  96.         //ページコンテンツを取得する
  97.         $pageContent $this->getPageContentRepository()->findOneByRouteName('app_default_holiday');
  98.         return $this->render('default/holiday.html.twig', [
  99.             'pageContent' => $pageContent,
  100.         ]);
  101.     }
  102.     /**
  103.      * @Route("/privacy/")
  104.      */
  105.     public function privacy(): Response
  106.     {
  107.         //ページコンテンツを取得する
  108.         $pageContent $this->getPageContentRepository()->findOneByRouteName('app_default_privacy');
  109.         return $this->render('default/privacy.html.twig', [
  110.             'pageContent' => $pageContent,
  111.         ]);
  112.     }
  113.     /**
  114.      * @Route("/company/")
  115.      */
  116.     public function company(): Response
  117.     {
  118.         //ページコンテンツを取得する
  119.         $pageContent $this->getPageContentRepository()->findOneByRouteName('app_default_company');
  120.         return $this->render('default/company.html.twig', [
  121.             'pageContent' => $pageContent,
  122.         ]);
  123.     }
  124.     /**
  125.      * @Route("/aosct/")
  126.      */
  127.     public function aosct(): Response
  128.     {
  129.         //ページコンテンツを取得する
  130.         $pageContent $this->getPageContentRepository()->findOneByRouteName('app_default_aosct');
  131.         return $this->render('default/aosct.html.twig', [
  132.             'pageContent' => $pageContent,
  133.         ]);
  134.     }
  135.     /**
  136.      * @Route("/postage/")
  137.      */
  138.     public function postage(): Response
  139.     {
  140.         //ページコンテンツを取得する
  141.         $pageContent $this->getPageContentRepository()->findOneByRouteName('app_default_postage');
  142.         return $this->render('default/postage.html.twig', [
  143.             'pageContent' => $pageContent,
  144.         ]);
  145.     }
  146.     /**
  147.      * @Route("/special/")
  148.      */
  149.     public function special(): Response
  150.     {
  151.         //ページコンテンツを取得する
  152.         $pageContent $this->getPageContentRepository()->findOneByRouteName('app_default_special');
  153.         return $this->render('default/special.html.twig', [
  154.             'pageContent' => $pageContent,
  155.         ]);
  156.     }
  157.     /**
  158.      * @Route("/amazon-fba/")
  159.      */
  160.     public function  amazonFba(): Response
  161.     {
  162.         //ページコンテンツを取得する
  163.         $pageContent $this->getPageContentRepository()->findOneByRouteName('app_default_amazonfba');
  164.         return $this->render('default/amazon_fba.html.twig', [
  165.             'pageContent' => $pageContent,
  166.         ]);
  167.     }
  168.     /**
  169.      * @Route("/new-function/")
  170.      */
  171.     public function  newfunction(): Response
  172.     {
  173.         //ページコンテンツを取得する
  174.         $pageContent $this->getPageContentRepository()->findOneByRouteName('app_default_newfunction');
  175.         return $this->render('default/newfunction.html.twig', [
  176.             'pageContent' => $pageContent,
  177.         ]);
  178.     }
  179.     /**
  180.      * @Route("/chrome-extension")
  181.      */
  182.     public function  chromeExtension(): Response
  183.     {
  184.         //ページコンテンツを取得する
  185.         $pageContent $this->getPageContentRepository()->findOneByRouteName("/chrome-extension/");
  186.         return $this->render('default/chromeextension.html.twig', [
  187.             'pageContent' => $pageContent,
  188.         ]);
  189.     }
  190.     /**
  191.      * @return \Xearts\Bundle\TaobaoDaikoBundle\Repository\InformationRepository
  192.      */
  193.     private function getInformationRepository(): InformationRepository
  194.     {
  195.         return $this->getDoctrine()->getRepository('XeartsTaobaoDaikoBundle:Information');
  196.     }
  197.     /**
  198.      * @return \Xearts\Bundle\TaobaoDaikoBundle\Repository\FeatureRepository
  199.      */
  200.     private function getFeatureRepository(): FeatureRepository
  201.     {
  202.         return $this->getDoctrine()->getRepository('XeartsTaobaoDaikoBundle:Feature');
  203.     }
  204.     /**
  205.      * @return \Xearts\Bundle\TaobaoDaikoBundle\Repository\PageContentRepository
  206.      */
  207.     private function getPageContentRepository(): PageContentRepository
  208.     {
  209.         return $this->getDoctrine()->getRepository('XeartsTaobaoDaikoBundle:PageContent');
  210.     }
  211.     private function getLogEntryRepository(): LogEntryRepository
  212.     {
  213.         return $this->getDoctrine()->getRepository(LogEntry::class);
  214.     }
  215. }