app/Customize/Controller/Block/CategoryDefController.php line 41

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\Block;
  13. use Eccube\Controller\AbstractController;
  14. use Customize\Repository\ProductRepository;
  15. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  16. use Symfony\Component\HttpFoundation\Request;
  17. use Symfony\Component\Routing\Annotation\Route;
  18. class CategoryDefController extends AbstractController
  19. {
  20.     /**
  21.      * @var ProductRepository
  22.      */
  23.     protected $productRepository;
  24.     /**
  25.      * CategoryDefController constructor.
  26.      */
  27.     public function __construct(ProductRepository $productRepository)
  28.     {
  29.         $this->productRepository $productRepository;
  30.     }
  31.     /**
  32.      * @Route("/block/category_def", name="block_category_def", methods={"GET"})
  33.      * @Template("Block/category_def.twig")
  34.      */
  35.     public function index(Request $request)
  36.     {
  37.         $searchData = array();
  38.         $searchData['product_type'] = "set";
  39.         $searchData['school_id'] =  $this->getUser()->getSchool()->getSchoolId();
  40.         $qb $this->productRepository->getQueryBuilderBySearchData($searchData);
  41.         return [
  42.             'SetProductCount' => count($qb->getQuery()->getResult()),
  43.         ];
  44.     }
  45.     /**
  46.      * @Route("/block/category_def_side", name="block_category_def_side", methods={"GET"})
  47.      * @Template("Block/category_def_side.twig")
  48.      */
  49.     public function side(Request $request)
  50.     {
  51.         $searchData = array();
  52.         $searchData['product_type'] = "set";
  53.         $searchData['school_id'] =  $this->getUser()->getSchool()->getSchoolId();
  54.         $qb $this->productRepository->getQueryBuilderBySearchData($searchData);
  55.         return [
  56.             'SetProductCount' => count($qb->getQuery()->getResult()),
  57.         ];
  58.     }
  59. }