app/Customize/Controller/FaqController.php line 59

Open in your IDE?
  1. <?php
  2. namespace Customize\Controller;
  3. use Customize\Entity\Enterprise;
  4. use Customize\Repository\CatalogFaqRepository;
  5. use Customize\Repository\EnterpriseRepository;
  6. use Customize\Repository\FaqRepository;
  7. use Customize\Repository\PriceListRepository;
  8. use Eccube\Controller\AbstractController;
  9. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  10. use Symfony\Component\HttpFoundation\Request;
  11. use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
  12. use Symfony\Component\Routing\Annotation\Route;
  13. class FaqController extends AbstractController
  14. {
  15.     /**
  16.      * @var CatalogFaqRepository
  17.      */
  18.     private $catalogFaqRepository;
  19.     private $faqRepository;
  20.     /**
  21.      * @var EnterpriseRepository
  22.      */
  23.     protected $EnterpriseRepository;
  24.     public function __construct(CatalogFaqRepository $catalogFaqRepositoryFaqRepository $faqRepository)
  25.     {
  26.         $this->catalogFaqRepository $catalogFaqRepository;
  27.         $this->faqRepository        $faqRepository;
  28.     }
  29.     /**
  30.      * FAQ
  31.      *
  32.      * @Route("/faq", name="page_faq", methods={"GET"})
  33.      * @Template("Faq/faq.twig")
  34.      */
  35.     public function faq()
  36.     {
  37.         $catalogList $this->catalogFaqRepository->getList(0);
  38.         /*dump($catalogList);
  39.         die();*/
  40.         return [
  41.             'data' => $catalogList
  42.         ];
  43.     }
  44.     /**
  45.      * FAQ Detail
  46.      *
  47.      * @Route("/faq/{id}", name="page_faq_detail", methods={"GET"}, requirements={"id" = "\d+"})
  48.      * @Template("Faq/faq_detail.twig")
  49.      */
  50.     public function faqDetail($id)
  51.     {
  52.         $data = array();
  53.         $catalogList $this->catalogFaqRepository->getList($id);
  54.         if ($catalogList) {
  55.             foreach ($catalogList as $k => $row) {
  56.                 $data[$k]['catalog'] = $row;
  57.                 $data[$k]['faq'] = $this->faqRepository->getListFaqByCatalog($row);
  58.             }
  59.         }
  60.         //
  61.         $catalogList $this->catalogFaqRepository->getList(0);
  62.         //
  63.         $catalog $this->catalogFaqRepository->find($id);
  64.         //
  65.         return [
  66.             'data'          => $data,
  67.             'catalogList'   => $catalogList,
  68.             'catalog'       => $catalog,
  69.         ];
  70.     }
  71. }