<?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\AbstractController;
use Customize\Repository\CategoryRepository;
use Customize\Repository\ArtistRepository;
use Customize\Entity\Artist;
use Eccube\Repository\ProductRepository;
class TopController extends AbstractController
{
/**
* @var CategoryRepository
*/
protected $categoryRepository;
/**
* @var ArtistRepository
*/
protected $artistRepository;
/**
* @var ProductRepository
*/
protected $productRepository;
/**
* @param CategoryRepository $categoryRepository
* @param ArtistRepository $artistRepository
* @param ProductRepository $productRepository
*/
public function __construct(
CategoryRepository $categoryRepository,
ArtistRepository $artistRepository,
ProductRepository $productRepository
) {
$this->categoryRepository = $categoryRepository;
$this->artistRepository = $artistRepository;
$this->productRepository = $productRepository;
}
/**
* @Route("/", name="homepage", methods={"GET"})
* @Template("index.twig")
*/
public function index()
{
$artists = $this->artistRepository->customFindAllArtist();
$categories = $this->categoryRepository->customFindAll();
$products = $this->productRepository->findAll();
return [
"products" => $products,
'artists' => $artists,
'categories' => $categories,
];
}
}