<?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;
class TopController extends AbstractController
{
/**
* @Route("/", name="homepage", methods={"GET"})
* @Template("index.twig")
*/
public function index()
{
$ProductRepository = $this->entityManager->getRepository(\Eccube\Entity\Product::class);
$qb = $ProductRepository->createQueryBuilder('p')
->where('p.Status = 1')
->orderBy('p.update_date', 'DESC')
->setMaxResults(4);
$Products = $qb->getQuery()->getResult();
$BlogRepository = $this->entityManager->getRepository(\Plugin\CMBlogPro42\Entity\Blog::class);
$qb = $BlogRepository->createQueryBuilder('b')
->where('b.Status = 1')
->orderBy('b.update_date', 'DESC')
->setMaxResults(3);
$Blogs = $qb->getQuery()->getResult();
return [
'topProducts' => $Products,
'topBlogs' => $Blogs,
];
}
}