<?php
/*
* This file is part of EC-CUBE
*
* Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
*
* http://www.ec-cube.co.jp/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Customize\Controller\Block;
use Eccube\Controller\AbstractController;
use Customize\Repository\ProductRepository;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
class CategoryDefController extends AbstractController
{
/**
* @var ProductRepository
*/
protected $productRepository;
/**
* CategoryDefController constructor.
*/
public function __construct(ProductRepository $productRepository)
{
$this->productRepository = $productRepository;
}
/**
* @Route("/block/category_def", name="block_category_def", methods={"GET"})
* @Template("Block/category_def.twig")
*/
public function index(Request $request)
{
$searchData = array();
$searchData['product_type'] = "set";
$searchData['school_id'] = $this->getUser()->getSchool()->getSchoolId();
$qb = $this->productRepository->getQueryBuilderBySearchData($searchData);
return [
'SetProductCount' => count($qb->getQuery()->getResult()),
];
}
/**
* @Route("/block/category_def_side", name="block_category_def_side", methods={"GET"})
* @Template("Block/category_def_side.twig")
*/
public function side(Request $request)
{
$searchData = array();
$searchData['product_type'] = "set";
$searchData['school_id'] = $this->getUser()->getSchool()->getSchoolId();
$qb = $this->productRepository->getQueryBuilderBySearchData($searchData);
return [
'SetProductCount' => count($qb->getQuery()->getResult()),
];
}
}