<?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;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\Routing\Annotation\Route;
use Eccube\Controller\HelpController;
use Eccube\Repository\ProductRepository;
class CustomHelpController extends HelpController
{
protected $productRepository;
public function __construct(ProductRepository $productRepository)
{
$this->productRepository = $productRepository;
}
/**
* 当サイトについて.
*
* @Route("/help/about", name="help_about", methods={"GET"})
* @Template("Help/about.twig")
*/
public function about()
{
$qb = $this->productRepository->getQueryBuilderBySearchData([]);
// is_hiddenフラグで非表示商品を除外
$qb->andWhere('p.is_hidden = :is_hidden OR p.is_hidden IS NULL')
->setParameter('is_hidden', false);
$qb->orderBy('p.id', 'ASC');
$products = $qb->getQuery()->getResult();
$subMapRaw = getenv('SUBSCRIPTION_MAP');
$subMap = [];
if (!empty($subMapRaw)) {
$subMapRaw = explode(',', $subMapRaw);
foreach ($subMapRaw as $map) {
$map = explode(':', $map);
$subMap[$map[0]] = $map[1];
}
}
return [
'products' => $products,
'subMap' => $subMap,
];
}
}