app/Customize/Controller/TopController.php line 27

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of EC-CUBE
  4.  *
  5.  * Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
  6.  *
  7.  * http://www.ec-cube.co.jp/
  8.  *
  9.  * For the full copyright and license information, please view the LICENSE
  10.  * file that was distributed with this source code.
  11.  */
  12. namespace Customize\Controller;
  13. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  14. use Symfony\Component\Routing\Annotation\Route;
  15. use Eccube\Controller\AbstractController;
  16. class TopController extends AbstractController
  17. {
  18.     /**
  19.      * @Route("/", name="homepage", methods={"GET"})
  20.      * @Template("index.twig")
  21.      */
  22.     public function index()
  23.     {
  24.         $ProductRepository $this->entityManager->getRepository(\Eccube\Entity\Product::class);
  25.         
  26.         $qb $ProductRepository->createQueryBuilder('p')
  27.             ->where('p.Status = 1')
  28.             ->orderBy('p.update_date''DESC')
  29.             ->setMaxResults(4);
  30.         $Products $qb->getQuery()->getResult();
  31.         $BlogRepository $this->entityManager->getRepository(\Plugin\CMBlogPro42\Entity\Blog::class);
  32.         $qb $BlogRepository->createQueryBuilder('b')
  33.             ->where('b.Status = 1')
  34.             ->orderBy('b.update_date''DESC')
  35.             ->setMaxResults(3);
  36.         $Blogs $qb->getQuery()->getResult();
  37.         return [
  38.             'topProducts' => $Products,
  39.             'topBlogs' => $Blogs,
  40.         ];
  41.     }
  42. }