app/Customize/Controller/CategoryController.php line 63

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of EC-CUBE
  4.  *
  5.  * Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
  6.  *
  7.  * http://www.ec-cube.co.jp/
  8.  *
  9.  * For the full copyright and license information, please view the LICENSE
  10.  * file that was distributed with this source code.
  11.  */
  12. namespace Customize\Controller;
  13. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  14. use Symfony\Component\Routing\Annotation\Route;
  15. use Eccube\Controller\AbstractController;
  16. use Customize\Repository\CategoryRepository;
  17. use Customize\Repository\ArtistRepository;
  18. use Customize\Entity\Artist
  19. use Eccube\Repository\ProductRepository;
  20. class CategoryController extends AbstractController
  21. {
  22.     /**
  23.      * @var CategoryRepository
  24.      */
  25.     protected $categoryRepository;
  26.     /**
  27.      * @var ArtistRepository
  28.      */
  29.     protected $artistRepository;
  30.     /**
  31.      * @var ProductRepository
  32.      */
  33.     protected $productRepository;
  34.       
  35.     /**
  36.      * @param CategoryRepository $categoryRepository
  37.      * @param ArtistRepository $artistRepository
  38.      * @param ProductRepository $productRepository
  39.      */
  40.     public function __construct(
  41.         CategoryRepository $categoryRepository,
  42.         ArtistRepository $artistRepository,
  43.         ProductRepository $productRepository
  44.     ) {
  45.         $this->categoryRepository $categoryRepository;
  46.         $this->artistRepository $artistRepository;
  47.         $this->productRepository $productRepository;
  48.     }
  49.     /**
  50.      * @Route("/category", name="category", methods={"GET"})
  51.      * @Template("Category/index.twig")
  52.      */
  53.     public function index()
  54.     {
  55.         $artists $this->artistRepository->customFindAllArtist();
  56.         $categories $this->categoryRepository->customFindAll();
  57.         $products $this->productRepository->findAll();
  58.         return [
  59.             "products" => $products,
  60.             'artists' => $artists,
  61.             'categories' => $categories,
  62.         ];
  63.     }
  64. }