<?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 Eccube\Controller\AbstractController;
use Eccube\Repository\CategoryRepository;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\Routing\Annotation\Route;
use Customize\Form\Type\SearchProductType;
class TopController extends AbstractController
{
/**
* @Route("/", name="homepage", methods={"GET"})
* @Template("index.twig")
*/
public function index(CategoryRepository $categoryRepository)
{
// searchForm
/* @var $builder \Symfony\Component\Form\FormBuilderInterface */
$builder = $this->formFactory->createNamedBuilder('', SearchProductType::class);
/* @var $searchForm \Symfony\Component\Form\FormInterface */
$searchForm = $builder->getForm();
$categories = $categoryRepository->findAll();
return [
'search_form' => $searchForm->createView(),
'categories' => $categories,
];
}
}